fix corner case in reduce_vars (#4262)

fixes #4261
This commit is contained in:
Alex Lam S.L
2020-11-07 02:00:04 +00:00
committed by GitHub
parent c2f6fd5fde
commit 4bbeb09f7c
4 changed files with 93 additions and 14 deletions

View File

@@ -1135,3 +1135,43 @@ issue_4248: {
}
expect_stdout: "PASS"
}
issue_4261: {
options = {
inline: true,
reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
{
const a = 42;
(function() {
function f() {
console.log(a);
}
function g() {
while (f());
}
(function() {
while (g());
})();
})();
}
}
expect: {
{
const a = 42;
(function() {
function g() {
while (void console.log(a));
}
(function() {
while (g());
})();
})();
}
}
expect_stdout: "42"
}