fix corner case in loops & unused (#4092)

fixes #4091
This commit is contained in:
Alex Lam S.L
2020-09-03 18:51:26 +01:00
committed by GitHub
parent 980fcbb56b
commit 6e235602fb
2 changed files with 77 additions and 15 deletions

View File

@@ -1037,3 +1037,54 @@ issue_4084: {
}
expect_stdout: "undefined"
}
issue_4091_1: {
options = {
loops: true,
toplevel: true,
unused: true,
}
input: {
try {
throw "FAIL";
} catch (e) {
for (var e in 42);
}
console.log(e && e);
}
expect: {
try {
throw "FAIL";
} catch (e) {
var e;
}
console.log(e && e);
}
expect_stdout: "undefined"
}
issue_4091_2: {
options = {
loops: true,
toplevel: true,
unused: true,
}
input: {
try {
throw "FAIL";
} catch (e) {
for (e in 42);
var e;
}
console.log(e && e);
}
expect: {
try {
throw "FAIL";
} catch (e) {
var e;
}
console.log(e && e);
}
expect_stdout: "undefined"
}