aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-01-03 19:28:47 +0800
committerGitHub <noreply@github.com>2020-01-03 19:28:47 +0800
commitfdc10086dafa3b1fbbb686f333b0b7b8e3bb70e5 (patch)
tree58497395924c767e7e39244726618ce96d33dd35 /test
parent746f5f6c62c113ce89981f70ec5de8c8b78016da (diff)
downloadtracifyjs-fdc10086dafa3b1fbbb686f333b0b7b8e3bb70e5.tar.gz
tracifyjs-fdc10086dafa3b1fbbb686f333b0b7b8e3bb70e5.zip
fix corner case in `reduce_vars` (#3667)
fixes #3666
Diffstat (limited to 'test')
-rw-r--r--test/compress/reduce_vars.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 5984042f..3331732a 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -6847,3 +6847,34 @@ issue_3631_2: {
}
expect_stdout: "undefined"
}
+
+issue_3666: {
+ options = {
+ collapse_vars: true,
+ passes: 2,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ try {
+ var a = "FAIL";
+ } finally {
+ for (;!a;)
+ var c = a++;
+ var a = "PASS", b = c = "PASS";
+ }
+ console.log(a, b);
+ }
+ expect: {
+ try {
+ var a = "FAIL";
+ } finally {
+ for (;!a;)
+ a++;
+ var b = a = "PASS";
+ }
+ console.log(a, b);
+ }
+ expect_stdout: "PASS PASS"
+}