diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-12-11 23:42:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-12 07:42:29 +0800 |
commit | 8c000033d3604dcad50faf31b2dbecc4f0fb98b6 (patch) | |
tree | 6fed821bde1c3a3da866c533a38566ed6df58fa1 /test/compress | |
parent | fd0d28e4652b8709d41031ef94594a50266f7c01 (diff) | |
download | tracifyjs-8c000033d3604dcad50faf31b2dbecc4f0fb98b6.tar.gz tracifyjs-8c000033d3604dcad50faf31b2dbecc4f0fb98b6.zip |
clarify corner case in object literal (#4371)
closes #4366
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/dead-code.js | 24 | ||||
-rw-r--r-- | test/compress/side_effects.js | 36 |
2 files changed, 60 insertions, 0 deletions
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js index 62efa460..84e7613a 100644 --- a/test/compress/dead-code.js +++ b/test/compress/dead-code.js @@ -1375,3 +1375,27 @@ issue_4051: { } expect_stdout: "PASS" } + +issue_4366: { + options = { + dead_code: true, + } + input: { + function f() { + return "PASS"; + ({ + p: 42, + get p() {}, + }); + } + console.log(f()); + } + expect: { + function f() { + return "PASS"; + } + console.log(f()); + } + expect_stdout: "PASS" + node_version: ">=4" +} diff --git a/test/compress/side_effects.js b/test/compress/side_effects.js index 0654a4ce..6428b172 100644 --- a/test/compress/side_effects.js +++ b/test/compress/side_effects.js @@ -470,3 +470,39 @@ issue_4325: { } expect_stdout: "PASS" } + +issue_4366_1: { + options = { + side_effects: true, + } + input: { + ({ + p: 42, + get p() {}, + q: console.log("PASS"), + }); + } + expect: { + console.log("PASS"); + } + expect_stdout: "PASS" + node_version: ">=4" +} + +issue_4366_2: { + options = { + side_effects: true, + } + input: { + ({ + set p(v) {}, + q: console.log("PASS"), + p: 42, + }); + } + expect: { + console.log("PASS"); + } + expect_stdout: "PASS" + node_version: ">=4" +} |