fix corner case in reduce_vars (#3129)

This commit is contained in:
Alex Lam S.L
2018-05-10 18:45:20 +08:00
committed by GitHub
parent 14e712ee80
commit 7bc7704edf
2 changed files with 53 additions and 13 deletions

View File

@@ -6059,6 +6059,38 @@ conditional_nested_2: {
expect_stdout: "1"
}
conditional_nested_3: {
options = {
evaluate: true,
reduce_vars: true,
}
input: {
var n = 2, c = 0;
(function f(a) {
0 < n-- && g(a = 1);
function g() {
a && c++;
}
g();
0 < n-- && f();
})();
console.log(c);
}
expect: {
var n = 2, c = 0;
(function f(a) {
0 < n-- && g(a = 1);
function g() {
a && c++;
}
g();
0 < n-- && f();
})();
console.log(c);
}
expect_stdout: "2"
}
issue_2436: {
options = {
evaluate: true,