diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-06-10 19:01:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 02:01:23 +0800 |
commit | 596fad182e853f83960b6b659b8093aa8ad09fc6 (patch) | |
tree | cdc89e0ddc233419971e01c6d6fb4789816a24e3 /test/compress/drop-unused.js | |
parent | ed69adedcd7140fd93d888d6b9dd46a6153adc7f (diff) | |
download | tracifyjs-596fad182e853f83960b6b659b8093aa8ad09fc6.tar.gz tracifyjs-596fad182e853f83960b6b659b8093aa8ad09fc6.zip |
fix corner case in `unused` (#3987)
fixes #3986
Diffstat (limited to 'test/compress/drop-unused.js')
-rw-r--r-- | test/compress/drop-unused.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index 8c912a57..b66320ad 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2755,3 +2755,37 @@ issue_3962_2: { } expect_stdout: "PASS" } + +issue_3986: { + options = { + reduce_vars: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + var a = 0, b = 0; + (function() { + try { + throw 42; + } catch (e) { + a++; + } + b = b && 0; + })(b *= a); + console.log(b); + } + expect: { + var a = 0, b = 0; + (function() { + try { + throw 42; + } catch (e) { + a++; + } + b = b && 0; + })(b *= a); + console.log(b); + } + expect_stdout: "0" +} |