fix corner cases with asynchronous generators (#4642)

fixes #4641
This commit is contained in:
Alex Lam S.L
2021-02-10 15:41:00 +00:00
committed by GitHub
parent f5659f292b
commit 083679bcad
4 changed files with 74 additions and 2 deletions

View File

@@ -5879,6 +5879,7 @@ collapse_rhs_this: {
collapse_rhs_undefined: {
options = {
collapse_vars: true,
side_effects: true,
}
input: {
var a, b;

View File

@@ -2460,6 +2460,7 @@ delay_def: {
evaluate: true,
reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
}
input: {

View File

@@ -889,3 +889,64 @@ issue_4639_2: {
expect_stdout: "undefined"
node_version: ">=4"
}
issue_4641_1: {
options = {
sequences: true,
}
input: {
console.log(typeof async function*() {
try {
console.log("foo");
return;
} finally {
console.log("bar");
}
}().next().then);
}
expect: {
console.log(typeof async function*() {
try {
console.log("foo");
return;
} finally {
console.log("bar");
}
}().next().then);
}
expect_stdout: [
"foo",
"bar",
"function",
]
node_version: ">=10"
}
issue_4641_2: {
options = {
side_effects: true,
}
input: {
console.log(typeof async function*() {
try {
return void "FAIL";
} finally {
console.log("PASS");
}
}().next().then);
}
expect: {
console.log(typeof async function*() {
try {
return void 0;
} finally {
console.log("PASS");
}
}().next().then);
}
expect_stdout: [
"function",
"PASS",
]
node_version: ">=10"
}