maintain order between side-effects and externally observable assignments (#2879)

fixes #2878
This commit is contained in:
Alex Lam S.L
2018-02-04 03:58:49 +08:00
committed by GitHub
parent 7e13c0db40
commit 78a44d5ab0
2 changed files with 34 additions and 1 deletions

View File

@@ -4433,3 +4433,37 @@ issue_2873_2: {
}
expect_stdout: "0 1"
}
issue_2878: {
options = {
collapse_vars: true,
sequences: true,
}
input: {
var c = 0;
(function (a, b) {
function f2() {
if (a) c++;
}
b = f2();
a = 1;
b && b.b;
f2();
})();
console.log(c);
}
expect: {
var c = 0;
(function (a, b) {
function f2() {
if (a) c++;
}
b = f2(),
a = 1,
b && b.b,
f2();
})(),
console.log(c);
}
expect_stdout: "1"
}