aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-07-16 15:13:33 +0100
committerGitHub <noreply@github.com>2021-07-16 22:13:33 +0800
commit902997b73dd0a6f3a8ada67f5e8bbfed000f5282 (patch)
tree9b021265404231071df862f0fefc21a2026d6560 /test
parentf18804fa068515f7142715a245c47094c9e348e7 (diff)
downloadtracifyjs-902997b73dd0a6f3a8ada67f5e8bbfed000f5282.tar.gz
tracifyjs-902997b73dd0a6f3a8ada67f5e8bbfed000f5282.zip
fix corner case in `inline` (#5083)
fixes #5082
Diffstat (limited to 'test')
-rw-r--r--test/compress/classes.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js
index d4047a8a..f604810a 100644
--- a/test/compress/classes.js
+++ b/test/compress/classes.js
@@ -2008,3 +2008,61 @@ issue_5053_4: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+issue_5082_1: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ class A {
+ p = console.log("PASS");
+ q() {}
+ }
+ class B {
+ static P = new A();
+ }
+ })();
+ }
+ expect: {
+ (function() {
+ class A {
+ p = console.log("PASS");
+ q() {}
+ }
+ new A();
+ })();
+ }
+ expect_stdout: "PASS"
+ node_version: ">=12"
+}
+
+issue_5082_2: {
+ options = {
+ inline: true,
+ passes: 2,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ class A {
+ p = console.log("PASS");
+ q() {}
+ }
+ class B {
+ static P = new A();
+ }
+ })();
+ }
+ expect: {
+ void new class {
+ p = console.log("PASS");
+ q() {}
+ }();
+ }
+ expect_stdout: "PASS"
+ node_version: ">=12"
+}