From: Mihai Bazon Date: Sun, 22 Dec 2013 09:36:45 +0000 (+0200) Subject: Optimize seq,void 0. Close #377. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=5a083a938d8d6eca5c43a5edd1921906299df18f;p=UglifyJS.git Optimize seq,void 0. Close #377. (x, void 0) => void x (x, undefined) => void x --- diff --git a/lib/compress.js b/lib/compress.js index 2a8b4c2e..a3ba16ab 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1836,6 +1836,18 @@ merge(Compressor.prototype, { return self.car; } } + if (self.cdr instanceof AST_UnaryPrefix + && self.cdr.operator == "void" + && !self.cdr.expression.has_side_effects(compressor)) { + self.cdr.operator = self.car; + return self.cdr; + } + if (self.cdr instanceof AST_Undefined) { + return make_node(AST_UnaryPrefix, self, { + operator : "void", + expression : self.car + }); + } return self; });