aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 312ce728..832f64f2 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1044,13 +1044,15 @@ merge(Compressor.prototype, {
// but are otherwise not safe to scan into or beyond them.
var sym;
if (node instanceof AST_Call
+ || node instanceof AST_Exit
+ && (side_effects || lhs instanceof AST_PropAccess || may_modify(lhs))
|| node instanceof AST_PropAccess
&& (side_effects || node.expression.may_throw_on_access(compressor))
|| node instanceof AST_SymbolRef
&& !(parent instanceof AST_Assign && parent.operator == "=" && parent.left === node)
- && (lvalues[node.name] || may_modify(node))
+ && (lvalues[node.name] || side_effects && may_modify(node))
|| node instanceof AST_VarDef && node.value
- && (node.name.name in lvalues || may_modify(node.name))
+ && (node.name.name in lvalues || side_effects && may_modify(node.name))
|| (sym = is_lhs(node.left, node))
&& (sym instanceof AST_PropAccess || sym.name in lvalues)
|| may_throw
@@ -1356,7 +1358,6 @@ merge(Compressor.prototype, {
}
function may_modify(sym) {
- if (!side_effects) return false;
var def = sym.definition();
if (def.orig.length == 1 && def.orig[0] instanceof AST_SymbolDefun) return false;
if (def.scope !== scope) return true;