diff options
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/compress.js b/lib/compress.js index c6558030..2224e144 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -9443,14 +9443,9 @@ merge(Compressor.prototype, { && !(exp instanceof AST_SymbolRef || exp instanceof AST_PropAccess || is_identifier_atom(exp))) { - if (exp instanceof AST_Sequence) { - exp = exp.expressions.slice(); - exp.push(make_node(AST_True, self)); - return make_sequence(self, exp).optimize(compressor); - } return make_sequence(self, [ exp, make_node(AST_True, self) ]).optimize(compressor); } - if (compressor.option("sequences") && !(op == "typeof" && is_undeclared_ref(exp.tail_node()))) { + if (compressor.option("sequences") && can_lift()) { var seq = lift_sequence_in_expression(self, compressor); if (seq !== self) return seq.optimize(compressor); } @@ -9500,6 +9495,17 @@ merge(Compressor.prototype, { // avoids infinite recursion of numerals return op == "-" && (exp instanceof AST_Number || exp instanceof AST_Infinity) ? self : try_evaluate(compressor, self); + + function can_lift() { + switch (op) { + case "delete": + return !is_identifier_atom(exp.tail_node()); + case "typeof": + return !is_undeclared_ref(exp.tail_node()); + default: + return true; + } + } }); OPT(AST_Await, function(self, compressor) { |