aboutsummaryrefslogtreecommitdiff
path: root/test/compress/classes.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-06-20 20:13:05 +0100
committerGitHub <noreply@github.com>2021-06-21 03:13:05 +0800
commite368d3971588c78413a91d89c23356d2f511c723 (patch)
treedcdaded481f64ec48b896f82b72f9a8111a6718a /test/compress/classes.js
parentfd8dec61ad0e83caa72691b56e1d36b6f29203a8 (diff)
downloadtracifyjs-e368d3971588c78413a91d89c23356d2f511c723.tar.gz
tracifyjs-e368d3971588c78413a91d89c23356d2f511c723.zip
fix corner cases in `reduce_vars` & `side_effects` (#5016)
fixes #5015
Diffstat (limited to 'test/compress/classes.js')
-rw-r--r--test/compress/classes.js83
1 files changed, 83 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js
index 4671fd07..c57842f9 100644
--- a/test/compress/classes.js
+++ b/test/compress/classes.js
@@ -1792,3 +1792,86 @@ issue_4996_2: {
expect_stdout: "0"
node_version: ">=12"
}
+
+issue_5015_1: {
+ options = {
+ side_effects: true,
+ }
+ input: {
+ "use strict";
+ var a;
+ try {
+ (class a {
+ [a]() {}
+ });
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ "use strict";
+ var a;
+ try {
+ (class a {
+ [a]() {}
+ });
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}
+
+issue_5015_2: {
+ options = {
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ }
+ input: {
+ "use strict";
+ try {
+ new class A {
+ [(A, 42)]() {}
+ }();
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ "use strict";
+ try {
+ new class A {
+ [(A, 42)]() {}
+ }();
+ } catch (e) {
+ console.log("PASS");
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}
+
+issue_5015_3: {
+ options = {
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ }
+ input: {
+ "use strict";
+ (class A {
+ static f() {
+ return A;
+ }
+ });
+ console.log("PASS");
+ }
+ expect: {
+ "use strict";
+ console.log("PASS");
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}