fix corner case in inline (#5306)

fixes #5305
This commit is contained in:
Alex Lam S.L
2022-01-19 00:14:19 +00:00
committed by GitHub
parent 8c2b76eff9
commit efed55f42d
2 changed files with 146 additions and 9 deletions

View File

@@ -496,6 +496,7 @@ inline_block_await: {
awaits: true,
if_return: true,
inline: true,
side_effects: true,
}
input: {
console.log("foo");
@@ -567,6 +568,7 @@ inline_block_await_async_return: {
awaits: true,
if_return: true,
inline: true,
side_effects: true,
}
input: {
console.log("foo");
@@ -2855,3 +2857,105 @@ issue_5298: {
expect_stdout: "PASS"
node_version: ">=8"
}
issue_5305_1: {
options = {
inline: true,
}
input: {
var a = "PASS";
(async function() {
try {
return await function() {
while (!console);
}();
} finally {
a = "FAIL";
}
})();
console.log(a);
}
expect: {
var a = "PASS";
(async function() {
try {
while (!console);
return await void 0;
} finally {
a = "FAIL";
}
})();
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=8"
}
issue_5305_2: {
options = {
inline: true,
}
input: {
var a = "PASS";
(async function() {
try {
throw null;
} catch (e) {
return await function() {
while (!console);
}();
} finally {
a = "FAIL";
}
})();
console.log(a);
}
expect: {
var a = "PASS";
(async function() {
try {
throw null;
} catch (e) {
while (!console);
return await void 0;
} finally {
a = "FAIL";
}
})();
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=8"
}
issue_5305_3: {
options = {
awaits: true,
inline: true,
side_effects: true,
}
input: {
var a = "PASS";
(async function() {
try {
await function() {
while (!console);
}();
} catch (e) {
a = "FAIL";
}
})();
console.log(a);
}
expect: {
var a = "PASS";
try {
while (!console);
} catch (e) {
a = "FAIL";
}
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=8"
}