aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-12-10 09:45:51 +0000
committerGitHub <noreply@github.com>2019-12-10 09:45:51 +0000
commit18c2b1841bf0bfa6c827eed53238d0499c143b23 (patch)
tree9925d4574fc7cca83f446011e385589f212cf48a /test
parentfe19ab7c57de1f3ba717ecd531e0e3f34c591a01 (diff)
downloadtracifyjs-18c2b1841bf0bfa6c827eed53238d0499c143b23.tar.gz
tracifyjs-18c2b1841bf0bfa6c827eed53238d0499c143b23.zip
fix corner case in `reduce_vars` (#3632)
fixes #3631
Diffstat (limited to 'test')
-rw-r--r--test/compress/reduce_vars.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 443c347d..5984042f 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -6801,3 +6801,49 @@ issue_3622: {
}
expect_stdout: "PASS"
}
+
+issue_3631_1: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var c = 0;
+ L: do {
+ for (;;) continue L;
+ var b = 1;
+ } while (b && c++);
+ console.log(c);
+ }
+ expect: {
+ var c = 0;
+ L: do {
+ for (;;) continue L;
+ var b = 1;
+ } while (b && c++);
+ console.log(c);
+ }
+ expect_stdout: "0"
+}
+
+issue_3631_2: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ L: for (var a = 1; a--; console.log(b)) {
+ for (;;) continue L;
+ var b = "FAIL";
+ }
+ }
+ expect: {
+ L: for (var a = 1; a--; console.log(b)) {
+ for (;;) continue L;
+ var b = "FAIL";
+ }
+ }
+ expect_stdout: "undefined"
+}