aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-08 23:59:52 +0000
committerGitHub <noreply@github.com>2021-03-09 07:59:52 +0800
commit01fa430a3e20098361ff8d35306ba1c31fea514c (patch)
tree6eed7493279a59aa71f42789bfcf3caa049a8737 /test
parentf4ee0f651c952eb85753633a990a598267981bcb (diff)
downloadtracifyjs-01fa430a3e20098361ff8d35306ba1c31fea514c.tar.gz
tracifyjs-01fa430a3e20098361ff8d35306ba1c31fea514c.zip
fix corner case in `unused` (#4757)
fixes #4756
Diffstat (limited to 'test')
-rw-r--r--test/compress/classes.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js
index a1b4f0cd..cebccf95 100644
--- a/test/compress/classes.js
+++ b/test/compress/classes.js
@@ -1244,3 +1244,34 @@ new_target: {
expect_stdout: "function"
node_version: ">=6"
}
+
+issue_4756: {
+ options = {
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ try {
+ class A extends 42 {
+ static [console.log("foo")] = console.log("bar");
+ }
+ } catch (e) {
+ console.log("baz");
+ }
+ }
+ expect: {
+ try {
+ (class extends 42 {
+ [console.log("foo")]() {}
+ }),
+ (() => console.log("bar"))();
+ } catch (e) {
+ console.log("baz");
+ }
+ }
+ expect_stdout: [
+ "foo",
+ "baz",
+ ]
+ node_version: ">=12"
+}