fix assignment logic in reduce_vars (#2872)

fixes #2869
This commit is contained in:
Alex Lam S.L
2018-02-03 01:33:09 +08:00
committed by GitHub
parent b16380d669
commit e773f03927
2 changed files with 32 additions and 6 deletions

View File

@@ -5507,3 +5507,29 @@ issue_2860_2: {
}
expect_stdout: "1"
}
issue_2869: {
options = {
evaluate: true,
reduce_vars: true,
}
input: {
var c = "FAIL";
(function f(a) {
var a;
if (!f) a = 0;
if (a) c = "PASS";
})(1);
console.log(c);
}
expect: {
var c = "FAIL";
(function f(a) {
var a;
if (!f) a = 0;
if (a) c = "PASS";
})(1);
console.log(c);
}
expect_stdout: "PASS"
}