Optimize seq,void 0. Close #377.

(x, void 0)    => void x
    (x, undefined) => void x
This commit is contained in:
Mihai Bazon
2013-12-22 11:36:45 +02:00
parent 7a30d826b8
commit 5a083a938d

View File

@@ -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;
});