drop argument value after collapse_vars (#2190)
This commit is contained in:
@@ -902,6 +902,14 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
|
||||
function remove_candidate(expr) {
|
||||
if (expr.name instanceof AST_SymbolFunarg) {
|
||||
var index = compressor.self().argnames.indexOf(expr.name);
|
||||
var args = compressor.parent().args;
|
||||
if (args[index]) args[index] = make_node(AST_Number, args[index], {
|
||||
value: 0
|
||||
});
|
||||
return true;
|
||||
}
|
||||
var found = false;
|
||||
return statements[stat_index].transform(new TreeTransformer(function(node, descend, in_list) {
|
||||
if (found) return node;
|
||||
@@ -3205,7 +3213,7 @@ merge(Compressor.prototype, {
|
||||
var value = stat.value;
|
||||
if (!value || value.is_constant_expression()) {
|
||||
var args = self.args.concat(value || make_node(AST_Undefined, self));
|
||||
return make_sequence(self, args).transform(compressor);
|
||||
return make_sequence(self, args).optimize(compressor);
|
||||
}
|
||||
}
|
||||
if (exp instanceof AST_Function) {
|
||||
@@ -3246,12 +3254,12 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
if (value) {
|
||||
var args = self.args.concat(value);
|
||||
return make_sequence(self, args).transform(compressor);
|
||||
return make_sequence(self, args).optimize(compressor);
|
||||
}
|
||||
}
|
||||
if (compressor.option("side_effects") && all(exp.body, is_empty)) {
|
||||
var args = self.args.concat(make_node(AST_Undefined, self));
|
||||
return make_sequence(self, args).transform(compressor);
|
||||
return make_sequence(self, args).optimize(compressor);
|
||||
}
|
||||
}
|
||||
if (compressor.option("drop_console")) {
|
||||
|
||||
Reference in New Issue
Block a user