drop unused extends properly (#5461)
This commit is contained in:
@@ -6788,7 +6788,6 @@ Compressor.prototype.compress = function(node) {
|
||||
}
|
||||
});
|
||||
// pass 3: we should drop declarations not in_use
|
||||
var unused_fn_names = [];
|
||||
var calls_to_drop_args = [];
|
||||
var fns_with_marked_args = [];
|
||||
var trimmer = new TreeTransformer(function(node) {
|
||||
@@ -6909,7 +6908,7 @@ Compressor.prototype.compress = function(node) {
|
||||
}
|
||||
}
|
||||
if (node instanceof AST_ClassExpression && node.name && drop_fn_name(node.name.definition())) {
|
||||
unused_fn_names.push(node);
|
||||
node.name = null;
|
||||
}
|
||||
if (node instanceof AST_Lambda) {
|
||||
if (drop_funcs && node !== self && node instanceof AST_LambdaDefinition) {
|
||||
@@ -6925,7 +6924,7 @@ Compressor.prototype.compress = function(node) {
|
||||
}
|
||||
}
|
||||
if (node instanceof AST_LambdaExpression && node.name && drop_fn_name(node.name.definition())) {
|
||||
unused_fn_names.push(node);
|
||||
node.name = null;
|
||||
}
|
||||
if (!(node instanceof AST_Accessor)) {
|
||||
var args, spread, trim = compressor.drop_fargs(node, parent);
|
||||
@@ -6966,6 +6965,7 @@ Compressor.prototype.compress = function(node) {
|
||||
}
|
||||
}
|
||||
var default_length = trim ? -1 : node.length();
|
||||
var trim_value = args && !node.uses_arguments && parent !== compressor.parent();
|
||||
for (var i = argnames.length; --i >= 0;) {
|
||||
var sym = argnames[i];
|
||||
if (sym instanceof AST_SymbolFunarg) {
|
||||
@@ -6987,7 +6987,7 @@ Compressor.prototype.compress = function(node) {
|
||||
} else {
|
||||
var trimmed = trim_destructured(sym, args[i], function(node) {
|
||||
return node.definition().id in in_use_ids ? node : null;
|
||||
}, !node.uses_arguments, sym);
|
||||
}, trim_value, sym);
|
||||
funarg = trimmed.name;
|
||||
if (trimmed.value) args[i] = trimmed.value;
|
||||
}
|
||||
@@ -7363,9 +7363,6 @@ Compressor.prototype.compress = function(node) {
|
||||
&& self.body[0].value == "use strict") {
|
||||
self.body.length = 0;
|
||||
}
|
||||
unused_fn_names.forEach(function(fn) {
|
||||
fn.name = null;
|
||||
});
|
||||
calls_to_drop_args.forEach(function(call) {
|
||||
drop_unused_call_args(call, compressor, fns_with_marked_args);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user