diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-11-18 15:43:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 23:43:55 +0800 |
commit | f6a83f794456c65ba927c0ccf55ff88c5c003a66 (patch) | |
tree | aab67c440c0011df3bfc21392c82bea5ab61cc1c /test/compress | |
parent | 35283e5dd18bb2b3be46a25786e2e73e8a24a863 (diff) | |
download | tracifyjs-f6a83f794456c65ba927c0ccf55ff88c5c003a66.tar.gz tracifyjs-f6a83f794456c65ba927c0ccf55ff88c5c003a66.zip |
fix corner case in `merge_vars` (#4299)
fixes #4298
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/destructured.js | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js index 4ef28864..cebb70ae 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -1490,10 +1490,10 @@ issue_4294: { expect: { A = "PASS"; (function() { - var a = function({ - [a]: {}, + var b = function({ + [b]: {}, }) {}({ - [a]: 0, + [b]: 0, }); var b = A; console.log(b); @@ -1502,3 +1502,41 @@ issue_4294: { expect_stdout: "PASS" node_version: ">=6" } + +issue_4298: { + options = { + merge_vars: true, + } + input: { + (function() { + var a = { + object: "PASS", + }; + function f({ + [typeof a]: b, + }) { + var a = b; + return a; + } + var c = f(a); + console.log(c); + })(); + } + expect: { + (function() { + var a = { + object: "PASS", + }; + function f({ + [typeof a]: b, + }) { + var a = b; + return a; + } + var c = f(a); + console.log(c); + })(); + } + expect_stdout: "PASS" + node_version: ">=6" +} |