aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-22 15:19:47 +0100
committerGitHub <noreply@github.com>2020-10-22 22:19:47 +0800
commit9e40abededaae3568e6cd931268cfaa0bd0ffbc0 (patch)
treedcbc391e63e65dcfd8a62a10f6130b058b222996 /test
parent23ca7d675f5c7bbd80571ce40b8d951831d359ad (diff)
downloadtracifyjs-9e40abededaae3568e6cd931268cfaa0bd0ffbc0.tar.gz
tracifyjs-9e40abededaae3568e6cd931268cfaa0bd0ffbc0.zip
fix corner case in `unused` (#4236)
fixes #4235
Diffstat (limited to 'test')
-rw-r--r--test/compress/drop-unused.js27
-rw-r--r--test/compress/ie8.js18
2 files changed, 45 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 257d7a76..4448bdd8 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -3085,3 +3085,30 @@ issue_4184: {
}
expect_stdout: "42"
}
+
+issue_4235: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ unused: true,
+ varify: true,
+ }
+ input: {
+ (function() {
+ {
+ const f = 0;
+ }
+ (function f() {
+ var f = console.log(f);
+ })();
+ })();
+ }
+ expect: {
+ (function() {
+ f = console.log(f),
+ void 0;
+ var f;
+ })();
+ }
+ expect_stdout: "undefined"
+}
diff --git a/test/compress/ie8.js b/test/compress/ie8.js
index f2132579..2a7dace3 100644
--- a/test/compress/ie8.js
+++ b/test/compress/ie8.js
@@ -2859,3 +2859,21 @@ issue_4186: {
}
expect_stdout: "NaN"
}
+
+issue_4235: {
+ options = {
+ ie8: true,
+ unused: true,
+ }
+ input: {
+ try {} catch (e) {}
+ console.log(function e() {
+ var e = 0;
+ }());
+ }
+ expect: {
+ try {} catch (e) {}
+ console.log(function e() {}());
+ }
+ expect_stdout: "undefined"
+}