Update dependencies

This commit is contained in:
grandeljay 2022-05-29 11:24:36 +02:00
parent 48e8c8a1af
commit 95d054f9b4
7555 changed files with 144369 additions and 196135 deletions

View file

@ -649,7 +649,7 @@ Compressor.prototype.compress = function(node) {
}
if (!HOP(tw.safe_ids, def.id)) {
if (!safe) return false;
if (safe.read) {
if (safe.read || tw.in_loop) {
var scope = tw.find_parent(AST_BlockScope);
if (scope instanceof AST_Class) return false;
if (def.scope.resolve() !== scope.resolve()) return false;
@ -6081,18 +6081,15 @@ Compressor.prototype.compress = function(node) {
}
if (node instanceof AST_Call) {
var exp = node.expression;
var tail = exp.tail_node();
if (!(tail instanceof AST_LambdaExpression)) {
if (exp instanceof AST_LambdaExpression) {
node.args.forEach(function(arg) {
arg.walk(tw);
});
exp.walk(tw);
} else {
descend();
return mark_expression(exp);
mark_expression(exp);
}
if (exp !== tail) exp.expressions.slice(0, -1).forEach(function(node) {
node.walk(tw);
});
node.args.forEach(function(arg) {
arg.walk(tw);
});
tail.walk(tw);
return true;
}
if (node instanceof AST_Class) {
@ -6105,9 +6102,10 @@ Compressor.prototype.compress = function(node) {
if (prop.static) {
prop.value.walk(tw);
} else {
push(tw);
push();
segment.block = node;
prop.value.walk(tw);
pop(tw);
pop();
}
});
return true;
@ -6172,6 +6170,8 @@ Compressor.prototype.compress = function(node) {
if (node === self) root = segment;
if (node instanceof AST_Lambda) {
if (node.name) references[node.name.definition().id] = false;
var parent = tw.parent();
var in_iife = parent && parent.TYPE == "Call" && parent.expression === node;
var marker = node.uses_arguments && !tw.has_directive("use strict") ? function(node) {
if (node instanceof AST_SymbolFunarg) references[node.definition().id] = false;
} : function(node) {
@ -6187,11 +6187,13 @@ Compressor.prototype.compress = function(node) {
|| node.parent_scope.find_variable(ref.name) === def)) {
references[def.id] = false;
references[ldef.id] = false;
} else {
} else if (in_iife) {
var save = segment;
pop();
mark(ref, true);
segment = save;
} else {
mark(ref, true);
}
return true;
});
@ -6214,7 +6216,8 @@ Compressor.prototype.compress = function(node) {
} else {
descend();
}
return mark_expression(exp);
mark_expression(exp);
return true;
}
if (node instanceof AST_Switch) {
node.expression.walk(tw);
@ -6246,9 +6249,7 @@ Compressor.prototype.compress = function(node) {
if (node instanceof AST_Try) {
var save_try = in_try;
in_try = node;
var save = segment;
walk_body(node, tw);
segment = save;
if (node.bcatch) {
if (node.bcatch.argname) node.bcatch.argname.mark_symbol(function(node) {
if (node instanceof AST_SymbolCatch) {
@ -6266,7 +6267,6 @@ Compressor.prototype.compress = function(node) {
}
}
in_try = save_try;
segment = save;
if (node.bfinally) node.bfinally.walk(tw);
return true;
}
@ -6316,11 +6316,9 @@ Compressor.prototype.compress = function(node) {
}
function mark_expression(exp) {
if (compressor.option("ie")) {
var sym = root_expr(exp);
if (sym instanceof AST_SymbolRef) sym.walk(tw);
}
return true;
if (!compressor.option("ie")) return;
var sym = root_expr(exp);
if (sym instanceof AST_SymbolRef) sym.walk(tw);
}
function walk_cond(condition, consequent, alternative) {
@ -11142,9 +11140,15 @@ Compressor.prototype.compress = function(node) {
&& assign instanceof AST_Assign
&& assign.operator == "="
&& self.left.equivalent_to(assign.left)) {
self.right = assign.right;
assign.right = self;
return assign;
return make_node(AST_Assign, self, {
operator: "=",
left: assign.left,
right: make_node(AST_Binary, self, {
operator: self.operator,
left: self.left,
right: assign.right,
}),
}).optimize(compressor);
}
}
if (compressor.option("comparisons")) switch (self.operator) {
@ -13382,7 +13386,7 @@ Compressor.prototype.compress = function(node) {
});
var body = [];
fn.variables.each(function(def, name) {
if (name == "arguments") return;
if (!arrow && name == "arguments" && def.orig.length == 1) return;
names.set(name, true);
scope.enclosed.push(def);
scope.variables.set(name, def);

View file

@ -469,6 +469,7 @@ AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) {
this.uses_arguments = false;
this.def_variable(new AST_SymbolFunarg({
name: "arguments",
scope: this,
start: this.start,
end: this.end,
}));