diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-11 19:26:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-12 03:26:12 +0800 |
commit | 83197ffdb3c9055b5699674e111d2dee390d5560 (patch) | |
tree | 76fb066c8c4d4510a5399560285a31b618eb054e /test | |
parent | 952765be66e45a10f59ef900a1bd4d90e38e9cf5 (diff) | |
download | tracifyjs-83197ffdb3c9055b5699674e111d2dee390d5560.tar.gz tracifyjs-83197ffdb3c9055b5699674e111d2dee390d5560.zip |
fix corner case in `evaluate` (#4645)
fixes #4644
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/rests.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/compress/rests.js b/test/compress/rests.js index 21adf204..59e29457 100644 --- a/test/compress/rests.js +++ b/test/compress/rests.js @@ -714,3 +714,52 @@ issue_4621: { expect_stdout: "PASS" node_version: ">=6" } + +issue_4644_1: { + options = { + evaluate: true, + } + input: { + var a = "FAIL"; + (function f(b, ...{ + [a = "PASS"]: c, + }) { + return b; + })(); + console.log(a); + } + expect: { + var a = "FAIL"; + (function f(b, ...{ + [a = "PASS"]: c, + }) { + return b; + })(); + console.log(a); + } + expect_stdout: "PASS" + node_version: ">=6" +} + +issue_4644_2: { + options = { + evaluate: true, + unsafe: true, + } + input: { + console.log(function(...a) { + return a[1]; + }("FAIL", "PASS"), function(...b) { + return b.length; + }(), function(c, ...d) { + return d[0]; + }("FAIL")); + } + expect: { + console.log("PASS", 0, function(c, ...d) { + return d[0]; + }("FAIL")); + } + expect_stdout: "PASS 0 undefined" + node_version: ">=6" +} |