aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-24 20:36:50 +0000
committerGitHub <noreply@github.com>2021-03-25 04:36:50 +0800
commit03c5ecb2e3d17e5919c1ca997f76900f1fa5b4dc (patch)
treefe0142412fc088c8945fe105c815f91724652be3 /test/compress
parent40ef074cb30e0b0114466406f6b9d8592faad14e (diff)
downloadtracifyjs-03c5ecb2e3d17e5919c1ca997f76900f1fa5b4dc.tar.gz
tracifyjs-03c5ecb2e3d17e5919c1ca997f76900f1fa5b4dc.zip
fix corner cases with `class` (#4822)
fixes #4821
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/classes.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js
index 7a9dfc51..a940e708 100644
--- a/test/compress/classes.js
+++ b/test/compress/classes.js
@@ -1296,3 +1296,51 @@ issue_4756: {
]
node_version: ">=12"
}
+
+issue_4821_1: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a;
+ class A {
+ static p = void (a = this);
+ }
+ console.log(typeof a);
+ }
+ expect: {
+ var a;
+ class A {
+ static p = void (a = this);
+ }
+ console.log(typeof a);
+ }
+ expect_stdout: "function"
+ node_version: ">=12"
+}
+
+issue_4821_2: {
+ options = {
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a;
+ class A {
+ static p = void (a = this);
+ }
+ console.log(typeof a);
+ }
+ expect: {
+ var a;
+ (class {
+ static p = void (a = this);
+ });
+ console.log(typeof a);
+ }
+ expect_stdout: "function"
+ node_version: ">=12"
+}