aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-20 14:54:27 +0000
committerGitHub <noreply@github.com>2020-12-20 22:54:27 +0800
commit47b63ed1a09caf5e15a51276adad83a94c89abac (patch)
tree0c833c73fc6afd64102695e5aaf0ffc929460e52 /test
parent7aefe97083c63660cf0708e549aebce66248796b (diff)
downloadtracifyjs-47b63ed1a09caf5e15a51276adad83a94c89abac.tar.gz
tracifyjs-47b63ed1a09caf5e15a51276adad83a94c89abac.zip
fix corner case in `collapse_vars` (#4431)
fixes #4430
Diffstat (limited to 'test')
-rw-r--r--test/compress/collapse_vars.js60
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"
+}