aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-11-05 00:00:18 +0800
committerGitHub <noreply@github.com>2017-11-05 00:00:18 +0800
commitfe5a68f9d5a93557d44c48cd0a8ee533e2bd1a47 (patch)
tree8e228eb21e078f380f4e9d47c7b2c17e74cd9d4e /test/compress/collapse_vars.js
parent71e61153b1b3d5f2446b83a3507231509e11e90e (diff)
downloadtracifyjs-fe5a68f9d5a93557d44c48cd0a8ee533e2bd1a47.tar.gz
tracifyjs-fe5a68f9d5a93557d44c48cd0a8ee533e2bd1a47.zip
maintain call argument order in `collapse_vars` (#2426)
fixes #2425
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index b5b97d24..e2c5f1be 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -2949,3 +2949,69 @@ conditional_2: {
}
expect_stdout: "5 5"
}
+
+issue_2425_1: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ var a = 8;
+ (function(b) {
+ b.toString();
+ })(--a, a |= 10);
+ console.log(a);
+ }
+ expect: {
+ var a = 8;
+ (function(b) {
+ b.toString();
+ })(--a, a |= 10);
+ console.log(a);
+ }
+ expect_stdout: "15"
+}
+
+issue_2425_2: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ var a = 8;
+ (function(b, c) {
+ b.toString();
+ })(--a, a |= 10);
+ console.log(a);
+ }
+ expect: {
+ var a = 8;
+ (function(b, c) {
+ b.toString();
+ })(--a, a |= 10);
+ console.log(a);
+ }
+ expect_stdout: "15"
+}
+
+issue_2425_3: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ var a = 8;
+ (function(b, b) {
+ b.toString();
+ })(--a, a |= 10);
+ console.log(a);
+ }
+ expect: {
+ var a = 8;
+ (function(b, b) {
+ (a |= 10).toString();
+ })(--a);
+ console.log(a);
+ }
+ expect_stdout: "15"
+}