fix corner case in unused (#4835)

fixes #4834
This commit is contained in:
Alex Lam S.L
2021-04-01 20:55:53 +01:00
committed by GitHub
parent 4084948d3b
commit e755d01a0b
2 changed files with 47 additions and 11 deletions

View File

@@ -3357,3 +3357,34 @@ issue_4806_3: {
}
expect_stdout: "PASS"
}
issue_4834: {
options = {
inline: true,
keep_fargs: false,
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
try {
new function(a, b) {
b;
b.p;
}(42);
} catch (e) {
console.log("PASS");
}
}
expect: {
try {
void b.p;
} catch (e) {
console.log("PASS");
}
var b;
}
expect_stdout: "PASS"
}