diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-04 04:18:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-04 04:18:22 +0800 |
commit | 3026bd89759446c9c5d6fa1cd69651f853ffe08d (patch) | |
tree | 1c420cfadf2844b3903579b37883394b59758e43 /lib | |
parent | 78a44d5ab0fd2195c8f22cc8a39193b33dad6188 (diff) | |
download | tracifyjs-3026bd89759446c9c5d6fa1cd69651f853ffe08d.tar.gz tracifyjs-3026bd89759446c9c5d6fa1cd69651f853ffe08d.zip |
improve exceptional flow compression by `collapse_vars` (#2880)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/compress.js b/lib/compress.js index f9cd7a41..321ee5fc 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1408,22 +1408,15 @@ merge(Compressor.prototype, { } function side_effects_external(node, lhs) { - if (node instanceof AST_Assign) { - return side_effects_external(node.left, true) - || side_effects_external(node.right); - } - if (node instanceof AST_Definitions) return false; + if (node instanceof AST_Assign) return side_effects_external(node.left, true); if (node instanceof AST_Unary) return side_effects_external(node.expression, true); if (node instanceof AST_VarDef) return node.value && side_effects_external(node.value); if (lhs) { if (node instanceof AST_Dot) return side_effects_external(node.expression, true); - if (node instanceof AST_Sub) { - return side_effects_external(node.expression, true) - || side_effects_external(node.property); - } + if (node instanceof AST_Sub) return side_effects_external(node.expression, true); if (node instanceof AST_SymbolRef) return node.definition().scope !== scope; } - return node.has_side_effects(compressor); + return false; } } |