fix corner case in unused (#5272)

fixes #5271
This commit is contained in:
Alex Lam S.L
2022-01-07 06:33:42 +00:00
committed by GitHub
parent 9aab1f3661
commit 58bea676ac
2 changed files with 31 additions and 7 deletions

View File

@@ -3561,3 +3561,29 @@ issue_5224: {
}
expect_stdout: "Infinity"
}
issue_5271: {
options = {
evaluate: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
function f() {
do {
var a = b = 0 ^ f, b = b;
} while (console.log(42 - b));
}
f();
}
expect: {
(function f() {
do {
var b;
b = 0 ^ f;
} while (console.log(42 - b));
})();
}
expect_stdout: "42"
}