@@ -7573,16 +7573,16 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
});
|
});
|
||||||
var abort = arrow && exp.value && !is_primitive(compressor, exp.value);
|
var abort = !drop_body && exp.name || arrow && exp.value && !is_primitive(compressor, exp.value);
|
||||||
var tw = new TreeWalker(function(node) {
|
var tw = new TreeWalker(function(node) {
|
||||||
if (abort) return true;
|
if (abort) return true;
|
||||||
|
if (tw.parent() === exp && node.may_throw(compressor)) return abort = true;
|
||||||
if (node instanceof AST_Await) return abort = true;
|
if (node instanceof AST_Await) return abort = true;
|
||||||
if (node instanceof AST_Return) {
|
if (node instanceof AST_Return) {
|
||||||
if (node.value && !is_primitive(compressor, node.value)) return abort = true;
|
if (node.value && !is_primitive(compressor, node.value)) return abort = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Scope && node !== exp) return true;
|
if (node instanceof AST_Scope && node !== exp) return true;
|
||||||
if (tw.parent() === exp && node.may_throw(compressor)) return abort = true;
|
|
||||||
});
|
});
|
||||||
exp.walk(tw);
|
exp.walk(tw);
|
||||||
if (!abort) {
|
if (!abort) {
|
||||||
|
|||||||
@@ -1682,3 +1682,47 @@ issue_4972_3: {
|
|||||||
]
|
]
|
||||||
node_version: ">=8"
|
node_version: ">=8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4974: {
|
||||||
|
options = {
|
||||||
|
awaits: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(async function f() {
|
||||||
|
return 42 in f();
|
||||||
|
})();
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(async function f() {
|
||||||
|
return 42 in f();
|
||||||
|
})();
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
expect_stdout: true
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_4975: {
|
||||||
|
options = {
|
||||||
|
awaits: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(async function f(a) {
|
||||||
|
try {
|
||||||
|
if (a) console.log(typeof f());
|
||||||
|
} catch (e) {}
|
||||||
|
})(42);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(async function f(a) {
|
||||||
|
try {
|
||||||
|
if (a) console.log(typeof f());
|
||||||
|
} catch (e) {}
|
||||||
|
})(42);
|
||||||
|
}
|
||||||
|
expect_stdout: "object"
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user