diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-05-30 02:00:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-30 09:00:48 +0800 |
commit | b9d5bba5fb8e70c10f25f56ff6e7228739461cfb (patch) | |
tree | c789e6a8a201708c59eefe6ff5b8b93c1d911bc0 /test/compress | |
parent | 8d23496e0fdf40f74273e7158417ff992006fe69 (diff) | |
download | tracifyjs-b9d5bba5fb8e70c10f25f56ff6e7228739461cfb.tar.gz tracifyjs-b9d5bba5fb8e70c10f25f56ff6e7228739461cfb.zip |
fix corner case in `dead_code` (#4983)
fixes #4982
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/classes.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js index bbfea753..cbecf669 100644 --- a/test/compress/classes.js +++ b/test/compress/classes.js @@ -1679,3 +1679,49 @@ issue_4962_2: { expect_stdout: "undefined" node_version: ">=12" } + +issue_4982_1: { + options = { + dead_code: true, + } + input: { + "use strict"; + try {} catch (e) { + class A extends 42 {} + } + console.log("PASS"); + } + expect: { + "use strict"; + { + class A {} + } + console.log("PASS"); + } + expect_stdout: "PASS" + node_version: ">=4" +} + +issue_4982_2: { + options = { + dead_code: true, + } + input: { + var a = "PASS"; + try {} catch (e) { + class A { + static p = a = "FAIL"; + } + } + console.log(a); + } + expect: { + var a = "PASS"; + { + class A {} + } + console.log(a); + } + expect_stdout: "PASS" + node_version: ">=12" +} |