aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-02 04:55:09 +0800
committerGitHub <noreply@github.com>2021-03-02 04:55:09 +0800
commit68b2dadc58d649f3a917b602a66804ad50aae2ae (patch)
tree8a92d35ea028d97ec4637c8699d312756f013d77 /test/compress
parentbd737200615551e49d929fd6a55c3c71362ec507 (diff)
downloadtracifyjs-68b2dadc58d649f3a917b602a66804ad50aae2ae.tar.gz
tracifyjs-68b2dadc58d649f3a917b602a66804ad50aae2ae.zip
enhance `side_effects` & `unused` (#4711)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/classes.js74
1 files changed, 73 insertions, 1 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js
index dea0d5b0..f94731fb 100644
--- a/test/compress/classes.js
+++ b/test/compress/classes.js
@@ -125,7 +125,7 @@ private_methods: {
}
expect_exact: "(new class A{static*#f(){yield 3*A.#p}async #g(){for(var a of A.#f())return a*await 2}static get #p(){return 7}get q(){return this.#g()}}).q.then(console.log);"
expect_stdout: "42"
- node_version: ">=14"
+ node_version: ">=14.6"
}
await: {
@@ -573,6 +573,78 @@ computed_key_generator: {
node_version: ">=4"
}
+issue_805_1: {
+ options = {
+ inline: true,
+ passes: 2,
+ pure_getters: "strict",
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ "use strict";
+ (function(a) {
+ var unused = class {};
+ unused.prototype[a()] = 42;
+ (unused.prototype.bar = function() {
+ console.log("bar");
+ })();
+ return unused;
+ })(function() {
+ console.log("foo");
+ return "foo";
+ });
+ }
+ expect: {
+ "use strict";
+ console.log("foo"),
+ console.log("bar");
+ }
+ expect_stdout: [
+ "foo",
+ "bar",
+ ]
+ node_version: ">=4"
+}
+
+issue_805_2: {
+ options = {
+ inline: true,
+ passes: 2,
+ pure_getters: "strict",
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ "use strict";
+ (function(a) {
+ class unused {}
+ unused.prototype[a()] = 42;
+ (unused.prototype.bar = function() {
+ console.log("bar");
+ })();
+ return unused;
+ })(function() {
+ console.log("foo");
+ return "foo";
+ });
+ }
+ expect: {
+ "use strict";
+ console.log("foo"),
+ console.log("bar");
+ }
+ expect_stdout: [
+ "foo",
+ "bar",
+ ]
+ node_version: ">=4"
+}
+
issue_4681: {
options = {
unused: true,