diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-22 15:19:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-22 22:19:47 +0800 |
commit | 9e40abededaae3568e6cd931268cfaa0bd0ffbc0 (patch) | |
tree | dcbc391e63e65dcfd8a62a10f6130b058b222996 /test | |
parent | 23ca7d675f5c7bbd80571ce40b8d951831d359ad (diff) | |
download | tracifyjs-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.js | 27 | ||||
-rw-r--r-- | test/compress/ie8.js | 18 |
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" +} |