diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-11 23:13:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-11 23:13:44 +0800 |
commit | b757450cd8e6c5f9fc766673a4ef9f32060703d7 (patch) | |
tree | 619e50268d344fc24da59784b8d9b80435c0651e /test/compress | |
parent | 23ec484806e1ed1cc7c2580abbd3ff050367b358 (diff) | |
download | tracifyjs-b757450cd8e6c5f9fc766673a4ef9f32060703d7.tar.gz tracifyjs-b757450cd8e6c5f9fc766673a4ef9f32060703d7.zip |
fix nested `unused` assignments (#2769)
fixes #2768
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/drop-unused.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index 5ad489b9..0ac7bb33 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -1644,3 +1644,51 @@ cascade_drop_assign: { } expect_stdout: "PASS" } + +chained_3: { + options = { + reduce_vars: true, + unused: true, + } + input: { + console.log(function(a, b) { + var c = a, c = b; + b++; + return c; + }(1, 2)); + } + expect: { + console.log(function(a, b) { + var c = b; + b++; + return c; + }(0, 2)); + } + expect_stdout: "2" +} + +issue_2768: { + options = { + inline: true, + reduce_vars: true, + sequences: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + var a = "FAIL", c = 1; + var c = function(b) { + var d = b = a; + var e = --b + (d && (a = "PASS")); + }(); + console.log(a, typeof c); + } + expect: { + var a = "FAIL"; + var c = (d = a, 0, void (d && (a = "PASS"))); + var d; + console.log(a, typeof c); + } + expect_stdout: "PASS undefined" +} |