fix corner case in conditionals (#3577)

fixes #3576
This commit is contained in:
Alex Lam S.L
2019-11-09 00:53:15 +08:00
committed by GitHub
parent 10648c9af6
commit 5045e140b1
2 changed files with 30 additions and 11 deletions

View File

@@ -1489,3 +1489,29 @@ angularjs_chain: {
}
}
}
issue_3576: {
options = {
conditionals: true,
evaluate: true,
pure_getters: "strict",
reduce_vars: true,
}
input: {
var c = "FAIL";
(function(a) {
(a = -1) ? (a && (a.a = 0)) : (a && (a.a = 0));
a && a[c = "PASS"]++;
})();
console.log(c);
}
expect: {
var c = "FAIL";
(function(a) {
a = -1, a, a.a = 0;
a, a[c = "PASS"]++;
})();
console.log(c);
}
expect_stdout: "PASS"
}