aboutsummaryrefslogtreecommitdiff
path: root/test/compress/functions.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-07 02:00:04 +0000
committerGitHub <noreply@github.com>2020-11-07 10:00:04 +0800
commit4bbeb09f7c12bfb3d12ac5264bbdf033ee0b66dc (patch)
tree78b2c332b58edf8b8b4dab82ff129657ce1d21af /test/compress/functions.js
parentc2f6fd5fded46624da3851e3accc3b5165e6d588 (diff)
downloadtracifyjs-4bbeb09f7c12bfb3d12ac5264bbdf033ee0b66dc.tar.gz
tracifyjs-4bbeb09f7c12bfb3d12ac5264bbdf033ee0b66dc.zip
fix corner case in `reduce_vars` (#4262)
fixes #4261
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r--test/compress/functions.js52
1 files changed, 47 insertions, 5 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index c2ab23f6..3b57fb2b 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -2081,7 +2081,7 @@ issue_3016_1: {
var b = 1;
do {
3[b];
- } while(0);
+ } while (0);
console.log(b);
}
expect_stdout: "1"
@@ -2112,7 +2112,7 @@ issue_3016_2: {
do {
a = 3,
a[b];
- } while(0);
+ } while (0);
var a;
console.log(b);
}
@@ -2145,7 +2145,7 @@ issue_3016_2_ie8: {
do {
a = 3,
a[b];
- } while(0);
+ } while (0);
var a;
console.log(b);
}
@@ -2175,7 +2175,7 @@ issue_3016_3: {
var b = 1;
do {
console.log((a = void 0, a ? "FAIL" : a = "PASS"));
- } while(b--);
+ } while (b--);
var a;
}
expect_stdout: [
@@ -2208,7 +2208,7 @@ issue_3016_3_ie8: {
var b = 1;
do {
console.log((a = void 0, a ? "FAIL" : a = "PASS"));
- } while(b--);
+ } while (b--);
var a;
}
expect_stdout: [
@@ -5141,3 +5141,45 @@ issue_4259: {
}
expect_stdout: "function"
}
+
+issue_4261: {
+ options = {
+ inline: true,
+ reduce_funcs: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ try {
+ throw 42;
+ } catch (e) {
+ (function() {
+ function f() {
+ e.p;
+ }
+ function g() {
+ while (f());
+ }
+ (function() {
+ while (console.log(g()));
+ })();
+ })();
+ }
+ }
+ expect: {
+ try {
+ throw 42;
+ } catch (e) {
+ (function() {
+ function g() {
+ while (void e.p);
+ }
+ (function() {
+ while (console.log(g()));
+ })();
+ })();
+ }
+ }
+ expect_stdout: true
+}