enhance awaits (#4971)

This commit is contained in:
Alex Lam S.L
2021-05-28 01:47:37 +01:00
committed by GitHub
parent 749a828fc5
commit 8cd95dd263
3 changed files with 117 additions and 39 deletions

View File

@@ -555,6 +555,51 @@ collapse_property_lambda: {
node_version: ">=8"
}
drop_async_1: {
options = {
awaits: true,
inline: true,
side_effects: true,
}
input: {
console.log(function(a) {
(async function() {
a *= 7;
})();
return a;
}(6));
}
expect: {
console.log(function(a) {
void (a *= 7);
return a;
}(6));
}
expect_stdout: "42"
node_version: ">=8"
}
drop_async_2: {
options = {
awaits: true,
collapse_vars: true,
evaluate: true,
inline: true,
side_effects: true,
}
input: {
console.log(function(a) {
(async b => await (a *= b))(7);
return a;
}(6));
}
expect: {
console.log(42);
}
expect_stdout: "42"
node_version: ">=8"
}
drop_return: {
options = {
side_effects: true,