aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-06-29 02:06:23 +0100
committerGitHub <noreply@github.com>2020-06-29 09:06:23 +0800
commit3bf8699f951c32a93414d1ac4c72364e2e282b33 (patch)
tree770c9164afcb11659c4dd5f9e36eff8bcef5c2ba /test
parent58c24f80078cd819ee1ae741655628cc6ec74c02 (diff)
downloadtracifyjs-3bf8699f951c32a93414d1ac4c72364e2e282b33.tar.gz
tracifyjs-3bf8699f951c32a93414d1ac4c72364e2e282b33.zip
fix corner case in `inline` (#4007)
fixes #4006
Diffstat (limited to 'test')
-rw-r--r--test/compress/functions.js31
-rw-r--r--test/ufuzz/index.js1
2 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 1383dbe9..18f4f900 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -4747,3 +4747,34 @@ issue_3929: {
}
expect_stdout: "function"
}
+
+issue_4006: {
+ options = {
+ dead_code: true,
+ evaluate: true,
+ inline: true,
+ keep_fargs: "strict",
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var a = 0;
+ (function() {
+ (function(b, c) {
+ for (var k in console.log(c), 0)
+ return b += 0;
+ })(0, --a);
+ return a ? 0 : --a;
+ })();
+ }
+ expect: {
+ var a = 0;
+ (function(c) {
+ for (var k in console.log(c), 0)
+ return;
+ })(--a), a || --a;
+ }
+ expect_stdout: "-1"
+}
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 7fe35308..64ea805c 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -197,6 +197,7 @@ BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
+BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
BINARY_OPS.push(" in ");
var ASSIGNMENTS = [