diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-03 01:33:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-03 01:33:09 +0800 |
commit | e773f0392769794173358b362a645facb51b2ad2 (patch) | |
tree | 119a78be61f37eb885caa5d65d01f1021a2d5569 /lib | |
parent | b16380d66961f408932de781a3425d2992ec51b3 (diff) | |
download | tracifyjs-e773f0392769794173358b362a645facb51b2ad2.tar.gz tracifyjs-e773f0392769794173358b362a645facb51b2ad2.zip |
fix assignment logic in `reduce_vars` (#2872)
fixes #2869
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/compress.js b/lib/compress.js index 832f64f2..77636cb2 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -710,19 +710,19 @@ merge(Compressor.prototype, { def(AST_VarDef, function(tw, descend) { var node = this; var d = node.name.definition(); - if (safe_to_assign(tw, d, node.value)) { - if (node.value) { + if (node.value) { + if (safe_to_assign(tw, d, node.value)) { d.fixed = function() { return node.value; }; tw.loop_ids[d.id] = tw.in_loop; mark(tw, d, false); descend(); + mark(tw, d, true); + return true; + } else { + d.fixed = false; } - mark(tw, d, true); - return true; - } else if (node.value) { - d.fixed = false; } }); def(AST_While, function(tw) { |