diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-01-04 02:17:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 10:17:32 +0800 |
commit | 5fbbb43839d010ec609da3bf15308cb5b6f74dc5 (patch) | |
tree | 9676cdb73f92dddf88dbb93b75aa0b30d1dff923 /test/compress | |
parent | df2cfcb5fcd7e4549df5015580c838138cd24130 (diff) | |
download | tracifyjs-5fbbb43839d010ec609da3bf15308cb5b6f74dc5.tar.gz tracifyjs-5fbbb43839d010ec609da3bf15308cb5b6f74dc5.zip |
fix corner cases in `inline` & `side_effects` (#4503)
fixes #4502
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/default-values.js | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js index cefffc58..7308b303 100644 --- a/test/compress/default-values.js +++ b/test/compress/default-values.js @@ -1341,3 +1341,86 @@ issue_4496: { ] node_version: ">=6" } + +issue_4502_1: { + options = { + inline: true, + unused: true, + } + input: { + (function() { + var a = "PASS"; + (function(b = a++) { + var a; + })(void 0, console.log(a)); + })(); + } + expect: { + (function() { + var a = "PASS"; + console.log(a), + a++, + void 0; + })(); + } + expect_stdout: "PASS" + node_version: ">=6" +} + +issue_4502_2: { + options = { + inline: true, + unused: true, + } + input: { + (function() { + var a = "PASS"; + (function(b = a++) {})(void 0, console.log(a)); + })(); + } + expect: { + (function() { + var a = "PASS"; + console.log(a), + a++, + void 0; + })(); + } + expect_stdout: "PASS" + node_version: ">=6" +} + +issue_4502_3: { + options = { + side_effects: true, + } + input: { + (function() { + var a = "PASS"; + (function(b = a++) {})(void 0, console.log(a)); + })(); + } + expect: { + (function() { + var a = "PASS"; + console.log(a), + a++; + })(); + } + expect_stdout: "PASS" + node_version: ">=6" +} + +issue_4502_4: { + options = { + side_effects: true, + } + input: { + (function(a, b = console.log("FAIL")) {})(..."" + console.log(42)); + } + expect: { + (function(a, b = console.log("FAIL")) {})(..."" + console.log(42)); + } + expect_stdout: "42" + node_version: ">=6" +} |