fix corner case in collapse_vars (#4875)

fixes #4874
This commit is contained in:
Alex Lam S.L
2021-04-27 01:54:02 +01:00
committed by GitHub
parent 97bd56b7e8
commit 4cccc01f3e
2 changed files with 28 additions and 0 deletions

View File

@@ -9030,3 +9030,30 @@ issue_4868: {
}
expect_stdout: "PASS"
}
issue_4874: {
options = {
collapse_vars: true,
evaluate: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a;
a = null;
(function(b) {
for (var c in b = b && b[console.log("PASS")])
console;
})(a = 42);
}
expect: {
var a;
null;
(function(b) {
for (var c in a && a[console.log("PASS")])
console;
})(a = 42);
}
expect_stdout: "PASS"
}