enhance if_return & inline (#5538)

This commit is contained in:
Alex Lam S.L
2022-07-06 04:40:07 +01:00
committed by GitHub
parent aa2a9fbedb
commit 0207b46d70
6 changed files with 536 additions and 30 deletions

View File

@@ -1731,7 +1731,7 @@ issue_3576: {
expect_stdout: "PASS"
}
issue_3668: {
issue_3668_1: {
options = {
conditionals: true,
if_return: true,
@@ -1748,6 +1748,38 @@ issue_3668: {
}
console.log(f());
}
expect: {
function f() {
try {
var undefined = typeof f;
if (!f) return undefined;
} catch (e) {
return "FAIL";
}
}
console.log(f());
}
expect_stdout: "undefined"
}
issue_3668_2: {
options = {
conditionals: true,
if_return: true,
}
input: {
function f() {
try {
var undefined = typeof f;
if (!f) return undefined;
return;
} catch (e) {
return "FAIL";
}
FAIL;
}
console.log(f());
}
expect: {
function f() {
try {
@@ -1756,6 +1788,7 @@ issue_3668: {
} catch (e) {
return "FAIL";
}
FAIL;
}
console.log(f());
}