diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-01-16 08:55:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-16 16:55:10 +0800 |
commit | 8d2151662355a05f1e2fde864168cfddd8eedcda (patch) | |
tree | 801af807b89d09b1b1d195987c48f4c81c35a090 /test/compress | |
parent | 74368c3dba66ce4c3d09f0a243a7a6eb55e9d85e (diff) | |
download | tracifyjs-8d2151662355a05f1e2fde864168cfddd8eedcda.tar.gz tracifyjs-8d2151662355a05f1e2fde864168cfddd8eedcda.zip |
fix corner cases in `reduce_vars` (#4561)
fixes #4560
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/spreads.js | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/compress/spreads.js b/test/compress/spreads.js index 7c98fdcd..7eac2482 100644 --- a/test/compress/spreads.js +++ b/test/compress/spreads.js @@ -846,3 +846,75 @@ issue_4556: { expect_stdout: "undefined" node_version: ">=6" } + +issue_4560_1: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + } + input: { + var a = 0; + (function(...{ + [a++]: {}, + }) {})(2); + console.log(a); + } + expect: { + var a = 0; + (function(...{ + [a++]: {}, + }) {})(2); + console.log(a); + } + expect_stdout: "1" + node_version: ">=6" +} + +issue_4560_2: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a = 0; + (function(...{ + [a++]: {}, + }) {})(2); + console.log(a); + } + expect: { + var a = 0; + (function(...{ + [a++]: {}, + }) {})(2); + console.log(a); + } + expect_stdout: "1" + node_version: ">=6" +} + +issue_4560_3: { + options = { + collapse_vars: true, + reduce_vars: true, + toplevel: true, + } + input: { + var a = 0, b; + [ ...{ + [a++]: b, + } ] = [ "PASS" ]; + console.log(b); + } + expect: { + var a = 0, b; + [ ...{ + [a++]: b, + } ] = [ "PASS" ]; + console.log(b); + } + expect_stdout: "PASS" + node_version: ">=6" +} |