handle negated constants correctly in collapse_vars (#2975)

fixes #2974
This commit is contained in:
Alex Lam S.L
2018-03-06 00:45:58 +08:00
committed by GitHub
parent 951d87ca94
commit fe51a91395
2 changed files with 37 additions and 2 deletions

View File

@@ -778,8 +778,7 @@ merge(Compressor.prototype, {
lhs = lhs.fixed_value();
}
if (!lhs) return true;
if (lhs instanceof AST_RegExp) return false;
if (lhs instanceof AST_Constant) return true;
if (lhs.is_constant()) return true;
return is_lhs_read_only(lhs);
}
return false;