@@ -7251,16 +7251,19 @@ Compressor.prototype.compress = function(node) {
|
||||
node.name = null;
|
||||
}
|
||||
if (node instanceof AST_Lambda) {
|
||||
descend_scope();
|
||||
if (drop_funcs && node !== self && node instanceof AST_LambdaDefinition) {
|
||||
var def = node.name.definition();
|
||||
if (!(def.id in in_use_ids)) {
|
||||
log(node.name, "Dropping unused function {name}");
|
||||
def.eliminated++;
|
||||
if (parent instanceof AST_ExportDefault) return to_func_expr(node, true);
|
||||
if (parent instanceof AST_ExportDefault) {
|
||||
descend_scope();
|
||||
return to_func_expr(node, true);
|
||||
}
|
||||
return in_list ? List.skip : make_node(AST_EmptyStatement, node);
|
||||
}
|
||||
}
|
||||
descend_scope();
|
||||
if (node instanceof AST_LambdaExpression && node.name && drop_fn_name(node.name.definition())) {
|
||||
node.name = null;
|
||||
}
|
||||
|
||||
@@ -584,7 +584,9 @@ issue_4668: {
|
||||
}
|
||||
expect: {
|
||||
console.log(function f() {
|
||||
(function g() {})();
|
||||
(function g() {
|
||||
0;
|
||||
})();
|
||||
}());
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
|
||||
@@ -2018,3 +2018,24 @@ issue_5684: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=10"
|
||||
}
|
||||
|
||||
issue_5707: {
|
||||
options = {
|
||||
hoist_props: true,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
yields: true,
|
||||
}
|
||||
input: {
|
||||
var a, b;
|
||||
function* f(c = (b = 42, console.log("PASS"))) {}
|
||||
b = f();
|
||||
}
|
||||
expect: {
|
||||
console.log("PASS");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user