fix corner case in if_return (#5598)

fixes #5597
This commit is contained in:
Alex Lam S.L
2022-08-03 23:50:51 +01:00
committed by GitHub
parent 8076d66ae5
commit 884842cd6c
2 changed files with 41 additions and 11 deletions

View File

@@ -2279,3 +2279,29 @@ issue_5595: {
}
expect_stdout: "PASS"
}
issue_5597: {
options = {
conditionals: true,
if_return: true,
unused: true,
}
input: {
function f(a) {
if (a) L: {
return;
var b;
} else
return "FAIL";
}
console.log(f(42) || "PASS");
}
expect: {
function f(a) {
if (!a)
return "FAIL";
}
console.log(f(42) || "PASS");
}
expect_stdout: "PASS"
}