fix corner case in hoist_vars (#5379)

fixes #5378
This commit is contained in:
Alex Lam S.L
2022-03-06 09:56:00 +00:00
committed by GitHub
parent 042c228c7b
commit 12a6728c4e
2 changed files with 55 additions and 23 deletions

View File

@@ -499,3 +499,34 @@ issue_5195: {
}
expect_stdout: "[object Object]"
}
issue_5378: {
options = {
hoist_vars: true,
inline: true,
toplevel: true,
}
input: {
var a = 2;
while (a--)
(function() {
var b;
var c;
while (console.log(b));
--b;
})();
}
expect: {
var a = 2;
while (a--) {
b = void 0;
var b, c;
while (console.log(b));
--b;
}
}
expect_stdout: [
"undefined",
"undefined",
]
}