aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-19 03:04:22 +0800
committerGitHub <noreply@github.com>2017-03-19 03:04:22 +0800
commitcd58635dcc8f74aafa842c2015b294ff4097ba08 (patch)
treed6f382af98d2b71c84948cd389c72ca981361d5e /test/compress
parent274331d0ea05197ea7cb531ccd1d78e0c7b8662c (diff)
downloadtracifyjs-cd58635dcc8f74aafa842c2015b294ff4097ba08.tar.gz
tracifyjs-cd58635dcc8f74aafa842c2015b294ff4097ba08.zip
fix AST_Binary.lift_sequences() (#1621)
Commit eab99a1c fails to account for side effects from compound assignments.
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/sequences.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/test/compress/sequences.js b/test/compress/sequences.js
index 41cfc726..f78987aa 100644
--- a/test/compress/sequences.js
+++ b/test/compress/sequences.js
@@ -103,15 +103,18 @@ lift_sequences_1: {
lift_sequences_2: {
options = { sequences: true, evaluate: true };
input: {
- var foo, bar;
+ var foo = 1, bar;
foo.x = (foo = {}, 10);
bar = (bar = {}, 10);
+ console.log(foo, bar);
}
expect: {
- var foo, bar;
+ var foo = 1, bar;
foo.x = (foo = {}, 10),
- bar = {}, bar = 10;
+ bar = {}, bar = 10,
+ console.log(foo, bar);
}
+ expect_stdout: true
}
lift_sequences_3: {
@@ -138,6 +141,23 @@ lift_sequences_4: {
}
}
+lift_sequences_5: {
+ options = {
+ sequences: true,
+ }
+ input: {
+ var a = 2, b;
+ a *= (b, a = 4, 3);
+ console.log(a);
+ }
+ expect: {
+ var a = 2, b;
+ b, a *= (a = 4, 3),
+ console.log(a);
+ }
+ expect_stdout: "6"
+}
+
for_sequences: {
options = { sequences: true };
input: {