aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-07-21 01:06:42 +0100
committeralexlamsl <alexlamsl@gmail.com>2020-07-21 17:21:58 +0800
commitbce3919748b1ece4d98625fee450f6096d7bb849 (patch)
tree6de9a73119f1cc959ec6e24eb342258bad760659 /test
parent61b66e83f1885dd8ad18ff510e38ab601ebf4c5c (diff)
downloadtracifyjs-bce3919748b1ece4d98625fee450f6096d7bb849.tar.gz
tracifyjs-bce3919748b1ece4d98625fee450f6096d7bb849.zip
fix corner case in `unused` (#4018)
fixes #4017
Diffstat (limited to 'test')
-rw-r--r--test/compress/drop-unused.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index b66320ad..26721755 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -2718,7 +2718,7 @@ issue_3962_1: {
0..toString();
} while (0);
if (c) console.log("PASS");
- })((a--, 1));
+ }((a--, 1)), 0);
void 0;
}
expect_stdout: "PASS"
@@ -2751,7 +2751,7 @@ issue_3962_2: {
0..toString();
} while (0);
if (c) console.log("PASS");
- })((a--, 1));
+ }((a--, 1)), 0);
}
expect_stdout: "PASS"
}
@@ -2789,3 +2789,27 @@ issue_3986: {
}
expect_stdout: "0"
}
+
+issue_4017: {
+ options = {
+ pure_getters: "strict",
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ var a = 0;
+ console.log(function f() {
+ var b = c &= 0;
+ var c = a++ + (A = a);
+ var d = c && c[f];
+ }());
+ }
+ expect: {
+ var a = 0;
+ console.log(function() {
+ c &= 0;
+ var c = (a++, A = a, 0);
+ }());
+ }
+ expect_stdout: "undefined"
+}