From 01fa430a3e20098361ff8d35306ba1c31fea514c Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 8 Mar 2021 23:59:52 +0000 Subject: fix corner case in `unused` (#4757) fixes #4756 --- test/compress/classes.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test') 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" +} -- cgit v1.2.3