fix corner case in conditionals & if_return (#5685)

fixes #5684
This commit is contained in:
Alex Lam S.L
2022-09-27 17:04:32 +01:00
committed by GitHub
parent 3fa2086681
commit a570c00251
2 changed files with 49 additions and 4 deletions

View File

@@ -1989,3 +1989,32 @@ issue_5679_6: {
expect_stdout: "PASS"
node_version: ">=10"
}
issue_5684: {
options = {
conditionals: true,
if_return: true,
}
input: {
(async function*() {
switch (42) {
default:
if (console.log("PASS"))
return;
return null;
case false:
}
})().next();
}
expect: {
(async function*() {
switch (42) {
default:
return console.log("PASS") ? void 0 : null;
case false:
}
})().next();
}
expect_stdout: "PASS"
node_version: ">=10"
}