diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-08-23 01:51:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-23 08:51:59 +0800 |
commit | db94d21980583714755322d5dd26bb0850801c03 (patch) | |
tree | 6a95caf1d84cf39e9012081fbd8c7e47356c5095 /test | |
parent | 9634a9d1fd882bcd17047c285c9e3d656ba08688 (diff) | |
download | tracifyjs-db94d21980583714755322d5dd26bb0850801c03.tar.gz tracifyjs-db94d21980583714755322d5dd26bb0850801c03.zip |
fix corner case in `side_effects` (#5118)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/default-values.js | 14 | ||||
-rw-r--r-- | test/compress/rests.js | 18 |
2 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js index 28cc46f0..13d4a18c 100644 --- a/test/compress/default-values.js +++ b/test/compress/default-values.js @@ -568,6 +568,20 @@ retain_empty_iife: { node_version: ">=6" } +drop_new_function: { + options = { + side_effects: true, + } + input: { + new function(a = console.log("PASS")) {}(); + } + expect: { + void console.log("PASS"); + } + expect_stdout: "PASS" + node_version: ">=6" +} + retain_fargs: { options = { unused: true, diff --git a/test/compress/rests.js b/test/compress/rests.js index a62e380a..24c6f878 100644 --- a/test/compress/rests.js +++ b/test/compress/rests.js @@ -636,6 +636,24 @@ keep_rest_lambda_2: { node_version: ">=6" } +drop_new_function: { + options = { + side_effects: true, + } + input: { + new function(...{ + [console.log("PASS")]: a, + }) {}(); + } + expect: { + void ([ ... { + [console.log("PASS")]: [].e, + }] = []); + } + expect_stdout: "PASS" + node_version: ">=6" +} + issue_4525_1: { options = { arguments: true, |