fix corner cases in if_return (#5590)

fixes #5589
fixes #5591
fixes #5592
This commit is contained in:
Alex Lam S.L
2022-07-30 19:45:52 +01:00
committed by GitHub
parent 6667440aaf
commit e39f33e41b
4 changed files with 357 additions and 11 deletions

View File

@@ -2122,3 +2122,51 @@ issue_5476: {
expect_stdout: "undefined"
node_version: ">=4"
}
issue_5591: {
options = {
dead_code: true,
if_return: true,
}
input: {
"use strict";
function f(a) {
switch (console.log("foo")) {
case console.log("bar"):
if (console.log("baz"))
return;
else {
let a;
return;
}
break;
case null:
FAIL;
}
}
f();
}
expect: {
"use strict";
function f(a) {
switch (console.log("foo")) {
case console.log("bar"):
if (console.log("baz"))
return;
else {
let a;
return;
}
case null:
FAIL;
}
}
f();
}
expect_stdout: [
"foo",
"bar",
"baz",
]
node_version: ">=4"
}