fix corner case in awaits (#4740)

fixes #4738
This commit is contained in:
Alex Lam S.L
2021-03-05 20:25:44 +00:00
committed by GitHub
parent fa09f87589
commit 83c3838b07
2 changed files with 125 additions and 7 deletions

View File

@@ -23,16 +23,34 @@ async_label: {
}
await_await: {
options = {
awaits: true,
side_effects: true,
}
input: {
(async function() {
console.log("PASS");
await await 42;
await await {
then(resolve) {
resolve({
then() {
console.log("PASS");
},
});
},
};
})();
}
expect: {
(async function() {
console.log("PASS");
await await 42;
await {
then(resolve) {
resolve({
then() {
console.log("PASS");
},
});
},
};
})();
}
expect_stdout: "PASS"
@@ -1280,3 +1298,84 @@ issue_4717: {
expect_stdout: "PASS"
node_version: ">=8"
}
issue_4738_1: {
options = {
awaits: true,
side_effects: true,
}
input: {
(async function() {
await {
then() {
console.log("PASS");
},
};
})();
}
expect: {
(async function() {
await {
then() {
console.log("PASS");
},
};
})();
}
expect_stdout: "PASS"
node_version: ">=8"
}
issue_4738_2: {
options = {
awaits: true,
side_effects: true,
}
input: {
(async function() {
await {
get then() {
console.log("PASS");
},
};
})();
}
expect: {
(async function() {
await {
get then() {
console.log("PASS");
},
};
})();
}
expect_stdout: "PASS"
node_version: ">=8"
}
issue_4738_3: {
options = {
awaits: true,
side_effects: true,
}
input: {
(async function() {
await {
then: function() {
console.log("PASS");
},
};
})();
}
expect: {
(async function() {
await {
then: function() {
console.log("PASS");
},
};
})();
}
expect_stdout: "PASS"
node_version: ">=8"
}