enhance awaits (#5637)

This commit is contained in:
Alex Lam S.L
2022-08-30 19:51:42 +01:00
committed by GitHub
parent 10bc86ba10
commit d530f9332c
2 changed files with 176 additions and 18 deletions

View File

@@ -529,6 +529,7 @@ inline_block_await: {
inline_block_await_async: {
options = {
awaits: true,
inline: true,
}
input: {
@@ -2747,6 +2748,7 @@ issue_5177: {
issue_5250: {
options = {
awaits: true,
inline: true,
}
input: {
@@ -2855,6 +2857,7 @@ issue_5298: {
issue_5305_1: {
options = {
awaits: true,
inline: true,
}
input: {
@@ -2888,6 +2891,7 @@ issue_5305_1: {
issue_5305_2: {
options = {
awaits: true,
inline: true,
}
input: {
@@ -3231,6 +3235,57 @@ issue_5528_4: {
}
issue_5634_1: {
options = {
awaits: true,
inline: true,
}
input: {
var a = "foo";
(async function() {
(async function() {
try {
return {
then(resolve) {
console.log("bar");
resolve();
console.log("baz");
},
};
} finally {
a = "moo";
}
})();
})();
console.log(a);
}
expect: {
var a = "foo";
(async function() {
(async function() {
try {
return {
then(resolve) {
console.log("bar");
resolve();
console.log("baz");
},
};
} finally {
a = "moo";
}
})();
})();
console.log(a);
}
expect_stdout: [
"moo",
"bar",
"baz",
]
node_version: ">=8"
}
issue_5634_1_side_effects: {
options = {
awaits: true,
inline: true,
@@ -3282,6 +3337,7 @@ issue_5634_1: {
issue_5634_2: {
options = {
awaits: true,
inline: true,
}
input: {
@@ -3330,6 +3386,56 @@ issue_5634_2: {
node_version: ">=8"
}
issue_5634_2_side_effects: {
options = {
awaits: true,
inline: true,
side_effects: true,
}
input: {
var a = "foo";
(async function() {
await async function() {
try {
return {
then(resolve) {
console.log("bar");
resolve();
console.log("baz");
},
};
} finally {
a = "moo";
}
}();
})();
console.log(a);
}
expect: {
var a = "foo";
(async function() {
try {
return {
then(resolve) {
console.log("bar");
resolve();
console.log("baz");
},
};
} finally {
a = "moo";
}
})();
console.log(a);
}
expect_stdout: [
"moo",
"bar",
"baz",
]
node_version: ">=8"
}
issue_5634_3: {
options = {
awaits: true,
@@ -3380,3 +3486,53 @@ issue_5634_3: {
]
node_version: ">=8"
}
issue_5634_3_side_effects: {
options = {
awaits: true,
inline: true,
side_effects: true,
}
input: {
var a = "foo";
(async function() {
return async function() {
try {
return {
then(resolve) {
console.log("bar");
resolve();
console.log("baz");
},
};
} finally {
a = "moo";
}
}();
})();
console.log(a);
}
expect: {
var a = "foo";
(async function() {
try {
return {
then(resolve) {
console.log("bar");
resolve();
console.log("baz");
},
};
} finally {
a = "moo";
}
})();
console.log(a);
}
expect_stdout: [
"moo",
"bar",
"baz",
]
node_version: ">=8"
}