diff options
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/compress.js b/lib/compress.js index 1f58b390..c7e08638 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -327,13 +327,7 @@ merge(Compressor.prototype, { d.fixed = false; } } else { - var parent = tw.parent(); - if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right - || parent instanceof AST_Call && node !== parent.expression - || parent instanceof AST_Return && node === parent.value && node.scope !== d.scope - || parent instanceof AST_VarDef && node === parent.value) { - d.escaped = true; - } + mark_escaped(d, node, 0); } } } @@ -579,6 +573,18 @@ merge(Compressor.prototype, { return !immutable && is_modified(parent, level + 1); } } + + function mark_escaped(d, node, level) { + var parent = tw.parent(level); + if (parent instanceof AST_Assign && parent.operator == "=" && node === parent.right + || parent instanceof AST_Call && node !== parent.expression + || parent instanceof AST_Return && node === parent.value && node.scope !== d.scope + || parent instanceof AST_VarDef && node === parent.value) { + d.escaped = true; + } else if (parent instanceof AST_PropAccess && node === parent.expression) { + mark_escaped(d, parent, level + 1); + } + } }); AST_SymbolRef.DEFMETHOD("fixed_value", function() { |