account for side-effects in comparisons of null & undefined (#2863)

This commit is contained in:
Alex Lam S.L
2018-02-01 19:15:17 +08:00
committed by GitHub
parent fad6766a90
commit c3a002ff97
2 changed files with 154 additions and 80 deletions

View File

@@ -4800,6 +4800,7 @@ merge(Compressor.prototype, {
&& lhs.operator == self.right.operator
&& (is_undefined(lhs.left, compressor) && self.right.left instanceof AST_Null
|| lhs.left instanceof AST_Null && is_undefined(self.right.left, compressor))
&& !lhs.right.has_side_effects(compressor)
&& lhs.right.equivalent_to(self.right.right)) {
var combined = make_node(AST_Binary, self, {
operator: lhs.operator.slice(0, -1),