aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-19 04:26:41 +0800
committerGitHub <noreply@github.com>2019-11-19 04:26:41 +0800
commit67278e76c8777d57d40b42151be28b527e692ba2 (patch)
tree225683cffe6311734150f1a67f52cddf1af4e4e7 /test
parentc289ba1139781f5619ec92136c2ceaac7d745ba7 (diff)
downloadtracifyjs-67278e76c8777d57d40b42151be28b527e692ba2.tar.gz
tracifyjs-67278e76c8777d57d40b42151be28b527e692ba2.zip
fix corner case in `unused` (#3599)
fixes #3598
Diffstat (limited to 'test')
-rw-r--r--test/compress/drop-unused.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 297fa01a..15420d8a 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -2235,3 +2235,34 @@ function_assign: {
}
expect_stdout: "PASS"
}
+
+issue_3598: {
+ options = {
+ collapse_vars: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ var a = "FAIL";
+ try {
+ (function() {
+ var b = void 0;
+ a = "PASS";
+ c.p = 0;
+ var c = b[!1];
+ })();
+ } catch (e) {}
+ console.log(a);
+ }
+ expect: {
+ var a = "FAIL";
+ try {
+ (function() {
+ a = "PASS";
+ var c = (void (c.p = 0))[!1];
+ })();
+ } catch (e) {}
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}