fix corner case in reduce_vars (#3667)

fixes #3666
This commit is contained in:
Alex Lam S.L
2020-01-03 19:28:47 +08:00
committed by GitHub
parent 746f5f6c62
commit fdc10086da
2 changed files with 50 additions and 15 deletions

View File

@@ -6847,3 +6847,34 @@ issue_3631_2: {
}
expect_stdout: "undefined"
}
issue_3666: {
options = {
collapse_vars: true,
passes: 2,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
try {
var a = "FAIL";
} finally {
for (;!a;)
var c = a++;
var a = "PASS", b = c = "PASS";
}
console.log(a, b);
}
expect: {
try {
var a = "FAIL";
} finally {
for (;!a;)
a++;
var b = a = "PASS";
}
console.log(a, b);
}
expect_stdout: "PASS PASS"
}