diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-11-21 00:57:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-21 08:57:59 +0800 |
commit | cf120c7cea2721626caa67767d720431becf7f62 (patch) | |
tree | e39a6d8f70385c02726bfdafdc20913a2239c595 /test | |
parent | 8d30902ba9e8a08945c8ae7cac0cb2feb27bb93c (diff) | |
download | tracifyjs-cf120c7cea2721626caa67767d720431becf7f62.tar.gz tracifyjs-cf120c7cea2721626caa67767d720431becf7f62.zip |
fix corner case in `merge_vars` & `reduce_vars` (#4313)
fixes #4312
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/destructured.js | 31 | ||||
-rw-r--r-- | test/compress/functions.js | 5 |
2 files changed, 34 insertions, 2 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js index f8e8090d..e654847a 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -1616,3 +1616,34 @@ issue_4308: { expect_stdout: "PASS" node_version: ">=6" } + +issue_4312: { + options = { + collapse_vars: true, + inline: true, + merge_vars: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a; + (function f(b, c) { + return function({ + [a = b]: d, + }) {}(c && c); + })("PASS", "FAIL"); + console.log(a); + } + expect: { + var a; + b = "PASS", + (function({ + [a = b]: d, + }){})((c = "FAIL") && c); + var b, c; + console.log(a); + } + expect_stdout: "PASS" + node_version: ">=6" +} diff --git a/test/compress/functions.js b/test/compress/functions.js index 686e7a50..e06596b8 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -521,7 +521,7 @@ issue_2531_2: { options = { evaluate: true, inline: true, - passes: 3, + passes: 2, reduce_funcs: true, reduce_vars: true, side_effects: true, @@ -556,9 +556,10 @@ issue_2531_3: { options = { evaluate: true, inline: true, - passes: 3, + passes: 2, reduce_funcs: true, reduce_vars: true, + sequences: true, side_effects: true, toplevel: true, unused: true, |