diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-06-04 21:06:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-05 04:06:43 +0800 |
commit | 04fd3d90f8600bc8c6c5715abce06617110d88d6 (patch) | |
tree | 67095e0c2d75d6c0f5ce2f7c58da63d723aedb23 /test/compress/drop-unused.js | |
parent | a489f8cb5e8fbf2c090df84b47b475375563e8d7 (diff) | |
download | tracifyjs-04fd3d90f8600bc8c6c5715abce06617110d88d6.tar.gz tracifyjs-04fd3d90f8600bc8c6c5715abce06617110d88d6.zip |
fix corner cases in `assignments`, `reduce_vars` & `unused` (#3950)
fixes #3949
fixes #3951
Diffstat (limited to 'test/compress/drop-unused.js')
-rw-r--r-- | test/compress/drop-unused.js | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index b21ca399..f3aeab21 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2285,7 +2285,7 @@ issue_3598: { try { (function() { a = "PASS"; - var c = (void (c.p = 0))[!1]; + (void ((void 0).p = 0))[!1]; })(); } catch (e) {} console.log(a); @@ -2557,10 +2557,9 @@ issue_3899: { console.log(typeof a); } expect: { - 0; - var a = function() { + function a() { return 2; - }; + } console.log(typeof a); } expect_stdout: "function" @@ -2625,3 +2624,31 @@ assign_if_assign_read: { } expect_stdout: "PASS" } + +issue_3951: { + options = { + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + var a = console.log("PASS"); + console.log(a); + a = "0"; + console.log(a.p = 0); + a && a; + } + expect: { + var a = console.log("PASS"); + console.log(a); + a = "0"; + console.log(a.p = 0); + } + expect_stdout: [ + "PASS", + "undefined", + "0", + ] +} |