fix corner case in inline (#5527)

fixes #5526
This commit is contained in:
Alex Lam S.L
2022-06-26 13:48:14 +01:00
committed by GitHub
parent fcc87edb71
commit f1b3e9df1e
11 changed files with 72 additions and 11 deletions

View File

@@ -836,8 +836,10 @@ inline_nested_async: {
inline_nested_block: {
options = {
dead_code: true,
if_return: true,
inline: true,
side_effects: true,
yields: true,
}
input: {
@@ -857,7 +859,6 @@ inline_nested_block: {
var a = function*() {
for (var a of [ "foo", "bar" ])
yield a;
"FAIL";
}(), b;
do {
b = a.next();
@@ -1562,3 +1563,39 @@ issue_5506: {
expect_stdout: "PASS"
node_version: ">=4"
}
issue_5526: {
options = {
inline: true,
side_effects: true,
}
input: {
(async function*() {
try {
return function() {
while (console.log("foo"));
}();
} finally {
console.log("bar");
}
})().next();
console.log("baz");
}
expect: {
(async function*() {
try {
while (console.log("foo"));
return void 0;
} finally {
console.log("bar");
}
})().next();
console.log("baz");
}
expect_stdout: [
"foo",
"baz",
"bar",
]
node_version: ">=10"
}