fix corner case in if_return (#5596)

fixes #5595
This commit is contained in:
Alex Lam S.L
2022-08-03 13:07:55 +01:00
committed by GitHub
parent 64e3ceec3b
commit 8076d66ae5
2 changed files with 35 additions and 7 deletions

View File

@@ -2253,3 +2253,29 @@ issue_5592_2: {
"baz",
]
}
issue_5595: {
options = {
conditionals: true,
if_return: true,
}
input: {
function f(a) {
if (a) {
var b;
if (b++)
return "FAIL";
} else
return "PASS";
}
console.log(f());
}
expect: {
function f(a) {
var b;
return a ? b++ ? "FAIL" : void 0 : "PASS";
}
console.log(f());
}
expect_stdout: "PASS"
}