aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-05 18:15:28 +0800
committerGitHub <noreply@github.com>2019-11-05 18:15:28 +0800
commit3e2c51a4da6fa27733b666f7db56d7ff7539fba0 (patch)
tree67a2e3fdaa1a664c0de4f7b32ba4e8a883f7b3e8 /test/compress/collapse_vars.js
parent0e29ad5eb9d6267c32f8ffb327aa79478c15e69c (diff)
downloadtracifyjs-3e2c51a4da6fa27733b666f7db56d7ff7539fba0.tar.gz
tracifyjs-3e2c51a4da6fa27733b666f7db56d7ff7539fba0.zip
enhance `collapse_vars` (#3572)
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 31978c29..cf4e45a5 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -6387,3 +6387,51 @@ issue_3562: {
}
expect_stdout: "PASS PASS"
}
+
+dot_throw_assign_sequence: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = "FAIL";
+ try {
+ var b;
+ b[0] = (a = "PASS", 0);
+ a = 1 + a;
+ } catch (c) {
+ }
+ console.log(a);
+ }
+ expect: {
+ var a = "FAIL";
+ try {
+ var b;
+ b[0] = (a = "PASS", 0);
+ a = 1 + a;
+ } catch (c) {
+ }
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}
+
+call_assign_order: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a, b = 1, c = 0, log = console.log;
+ (function() {
+ a = b = "PASS";
+ })((b = "FAIL", c++));
+ log(a, b);
+ }
+ expect: {
+ var a, b = 1, c = 0, log = console.log;
+ (function() {
+ a = b = "PASS";
+ })((b = "FAIL", c++));
+ log(a, b);
+ }
+ expect_stdout: "PASS PASS"
+}