@@ -10334,7 +10334,7 @@ merge(Compressor.prototype, {
|
|||||||
do {
|
do {
|
||||||
node = parent;
|
node = parent;
|
||||||
parent = compressor.parent(level++);
|
parent = compressor.parent(level++);
|
||||||
if (parent instanceof AST_Try && member(node, parent.body)) {
|
if (parent instanceof AST_Try && (parent.bfinally || parent.bcatch) !== node) {
|
||||||
drop = false;
|
drop = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2143,3 +2143,72 @@ issue_5157_promise: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=8"
|
node_version: ">=8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5159_1: {
|
||||||
|
options = {
|
||||||
|
awaits: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
throw "foo";
|
||||||
|
} catch (e) {
|
||||||
|
return await "bar";
|
||||||
|
} finally {
|
||||||
|
console.log("baz");
|
||||||
|
}
|
||||||
|
})().catch(console.log).then(console.log);
|
||||||
|
console.log("moo");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
throw "foo";
|
||||||
|
} catch (e) {
|
||||||
|
return await "bar";
|
||||||
|
} finally {
|
||||||
|
console.log("baz");
|
||||||
|
}
|
||||||
|
})().catch(console.log).then(console.log);
|
||||||
|
console.log("moo");
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"moo",
|
||||||
|
"baz",
|
||||||
|
"bar",
|
||||||
|
]
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5159_2: {
|
||||||
|
options = {
|
||||||
|
awaits: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
throw "foo";
|
||||||
|
} catch (e) {
|
||||||
|
return await "bar";
|
||||||
|
}
|
||||||
|
})().catch(console.log).then(console.log);
|
||||||
|
console.log("baz");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
throw "foo";
|
||||||
|
} catch (e) {
|
||||||
|
return "bar";
|
||||||
|
}
|
||||||
|
})().catch(console.log).then(console.log);
|
||||||
|
console.log("baz");
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"baz",
|
||||||
|
"bar",
|
||||||
|
]
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user