diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-26 14:21:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-26 14:21:11 +0800 |
commit | 193612ac67ef269d6b05fdf61c9638a5eebd76f7 (patch) | |
tree | 775406c79a6871980c1aa3a489a5845bfc2f1d85 /test/compress | |
parent | 95cfce68eae6173a76e8f01fae08a91f5d8996d2 (diff) | |
download | tracifyjs-193612ac67ef269d6b05fdf61c9638a5eebd76f7.tar.gz tracifyjs-193612ac67ef269d6b05fdf61c9638a5eebd76f7.zip |
fix accounting after conversion to assignment (#2847)
Missing reference to `AST_SymbolRef` created by `unused` causes `collapse_vars` to misbehave.
fixes #2846
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/drop-unused.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index 0ac7bb33..e99d7ab1 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -1692,3 +1692,30 @@ issue_2768: { } expect_stdout: "PASS undefined" } + +issue_2846: { + options = { + collapse_vars: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + function f(a, b) { + var a = 0; + b && b(a); + return a++; + } + var c = f(); + console.log(c); + } + expect: { + var c = function(a, b) { + a = 0; + b && b(a); + return a++; + }(); + console.log(c); + } + expect_stdout: "0" +} |