aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-26 05:40:31 +0000
committerGitHub <noreply@github.com>2020-12-26 13:40:31 +0800
commitbe1f5199f422080a42e962670758bd68f34b5bb6 (patch)
treead7d12505b13199bfdc32b4f6c5edf000433ea28 /test/compress
parent95aea0e33ce0288d7c31b11b044432f2043cf3d1 (diff)
downloadtracifyjs-be1f5199f422080a42e962670758bd68f34b5bb6.tar.gz
tracifyjs-be1f5199f422080a42e962670758bd68f34b5bb6.zip
fix corner cases in `collapse_vars` (#4462)
fixes #4460 fixes #4461
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/default-values.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js
index eefa6e0e..0e05d37d 100644
--- a/test/compress/default-values.js
+++ b/test/compress/default-values.js
@@ -1100,3 +1100,63 @@ issue_4458: {
expect_stdout: "PASS 42"
node_version: ">=6"
}
+
+issue_4460: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var log = console.log, a = "FAIL";
+ var [ b = a ] = (a = "PASS", []);
+ log(a, b);
+ }
+ expect: {
+ var log = console.log, a = "FAIL";
+ var [ b = a ] = (a = "PASS", []);
+ log(a, b);
+ }
+ expect_stdout: "PASS PASS"
+ node_version: ">=6"
+}
+
+issue_4461_1: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ var a = 0;
+ (function(b = a && console.log("PASS"), c) {
+ return c;
+ })(void 0, a++);
+ }
+ expect: {
+ var a = 0;
+ (function(b = a && console.log("PASS"), c) {
+ return c;
+ })(void 0, a++);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+issue_4461_2: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ var a = 0;
+ (function([ b = a && console.log("PASS") ], c) {
+ return c;
+ })([], a++);
+ }
+ expect: {
+ var a = 0;
+ (function([ b = a && console.log("PASS") ], c) {
+ return c;
+ })([], a++);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}