diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-12-20 14:54:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-20 22:54:27 +0800 |
commit | 47b63ed1a09caf5e15a51276adad83a94c89abac (patch) | |
tree | 0c833c73fc6afd64102695e5aaf0ffc929460e52 /test/compress/collapse_vars.js | |
parent | 7aefe97083c63660cf0708e549aebce66248796b (diff) | |
download | tracifyjs-47b63ed1a09caf5e15a51276adad83a94c89abac.tar.gz tracifyjs-47b63ed1a09caf5e15a51276adad83a94c89abac.zip |
fix corner case in `collapse_vars` (#4431)
fixes #4430
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r-- | test/compress/collapse_vars.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index edf4795a..17ee8d10 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -8602,3 +8602,63 @@ issue_4248: { } expect_stdout: "1" } + +issue_4430_1: { + options = { + collapse_vars: true, + pure_getters: "strict", + } + input: { + function f(a) { + switch (a = 1, arguments[0]) { + case 1: + return "PASS"; + case 2: + return "FAIL"; + } + } + console.log(f(2)); + } + expect: { + function f(a) { + switch (a = 1, arguments[0]) { + case 1: + return "PASS"; + case 2: + return "FAIL"; + } + } + console.log(f(2)); + } + expect_stdout: "PASS" +} + +issue_4430_2: { + options = { + collapse_vars: true, + pure_getters: "strict", + } + input: { + function f(a) { + switch (a = 0, arguments[0]) { + case 0: + return "PASS"; + case 1: + return "FAIL"; + } + } + console.log(f(1)); + } + expect: { + function f(a) { + switch (arguments[a = 0]) { + case 0: + return "PASS"; + case 1: + return "FAIL"; + } + } + console.log(f(1)); + } + expect_stdout: "PASS" +} |