@@ -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 && parent.bfinally && parent.bfinally !== node) {
|
if (parent instanceof AST_Try && member(node, parent.body)) {
|
||||||
drop = false;
|
drop = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2046,3 +2046,100 @@ issue_5070: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=10"
|
node_version: ">=10"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5157_async_function: {
|
||||||
|
options = {
|
||||||
|
awaits: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
async function f() {
|
||||||
|
throw "FAIL";
|
||||||
|
}
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
return await f();
|
||||||
|
} catch (e) {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
})().then(console.log);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
async function f() {
|
||||||
|
throw "FAIL";
|
||||||
|
}
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
return await f();
|
||||||
|
} catch (e) {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
})().then(console.log);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5157_async_iife: {
|
||||||
|
options = {
|
||||||
|
awaits: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
return await async function() {
|
||||||
|
throw "FAIL";
|
||||||
|
}();
|
||||||
|
} catch (e) {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
})().then(console.log);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
return await async function() {
|
||||||
|
throw "FAIL";
|
||||||
|
}();
|
||||||
|
} catch (e) {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
})().then(console.log);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5157_promise: {
|
||||||
|
options = {
|
||||||
|
awaits: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var p = new Promise(function(resolve, reject) {
|
||||||
|
reject("FAIL");
|
||||||
|
});
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
return await p;
|
||||||
|
} catch (e) {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
})().then(console.log);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var p = new Promise(function(resolve, reject) {
|
||||||
|
reject("FAIL");
|
||||||
|
});
|
||||||
|
(async function() {
|
||||||
|
try {
|
||||||
|
return await p;
|
||||||
|
} catch (e) {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
})().then(console.log);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user