@@ -6081,18 +6081,15 @@ Compressor.prototype.compress = function(node) {
|
|||||||
}
|
}
|
||||||
if (node instanceof AST_Call) {
|
if (node instanceof AST_Call) {
|
||||||
var exp = node.expression;
|
var exp = node.expression;
|
||||||
var tail = exp.tail_node();
|
if (exp instanceof AST_LambdaExpression) {
|
||||||
if (!(tail instanceof AST_LambdaExpression)) {
|
node.args.forEach(function(arg) {
|
||||||
|
arg.walk(tw);
|
||||||
|
});
|
||||||
|
exp.walk(tw);
|
||||||
|
} else {
|
||||||
descend();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Class) {
|
if (node instanceof AST_Class) {
|
||||||
@@ -6172,6 +6169,8 @@ Compressor.prototype.compress = function(node) {
|
|||||||
if (node === self) root = segment;
|
if (node === self) root = segment;
|
||||||
if (node instanceof AST_Lambda) {
|
if (node instanceof AST_Lambda) {
|
||||||
if (node.name) references[node.name.definition().id] = false;
|
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) {
|
var marker = node.uses_arguments && !tw.has_directive("use strict") ? function(node) {
|
||||||
if (node instanceof AST_SymbolFunarg) references[node.definition().id] = false;
|
if (node instanceof AST_SymbolFunarg) references[node.definition().id] = false;
|
||||||
} : function(node) {
|
} : function(node) {
|
||||||
@@ -6187,11 +6186,13 @@ Compressor.prototype.compress = function(node) {
|
|||||||
|| node.parent_scope.find_variable(ref.name) === def)) {
|
|| node.parent_scope.find_variable(ref.name) === def)) {
|
||||||
references[def.id] = false;
|
references[def.id] = false;
|
||||||
references[ldef.id] = false;
|
references[ldef.id] = false;
|
||||||
} else {
|
} else if (in_iife) {
|
||||||
var save = segment;
|
var save = segment;
|
||||||
pop();
|
pop();
|
||||||
mark(ref, true);
|
mark(ref, true);
|
||||||
segment = save;
|
segment = save;
|
||||||
|
} else {
|
||||||
|
mark(ref, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -6214,7 +6215,8 @@ Compressor.prototype.compress = function(node) {
|
|||||||
} else {
|
} else {
|
||||||
descend();
|
descend();
|
||||||
}
|
}
|
||||||
return mark_expression(exp);
|
mark_expression(exp);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Switch) {
|
if (node instanceof AST_Switch) {
|
||||||
node.expression.walk(tw);
|
node.expression.walk(tw);
|
||||||
@@ -6313,11 +6315,9 @@ Compressor.prototype.compress = function(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mark_expression(exp) {
|
function mark_expression(exp) {
|
||||||
if (compressor.option("ie")) {
|
if (!compressor.option("ie")) return;
|
||||||
var sym = root_expr(exp);
|
var sym = root_expr(exp);
|
||||||
if (sym instanceof AST_SymbolRef) sym.walk(tw);
|
if (sym instanceof AST_SymbolRef) sym.walk(tw);
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function walk_cond(condition, consequent, alternative) {
|
function walk_cond(condition, consequent, alternative) {
|
||||||
|
|||||||
@@ -3535,3 +3535,34 @@ issue_5405_2: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5423: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a, b;
|
||||||
|
function f({
|
||||||
|
[function() {
|
||||||
|
if (++a)
|
||||||
|
return 42;
|
||||||
|
}()]: c
|
||||||
|
}) {}
|
||||||
|
f(b = f);
|
||||||
|
console.log(typeof b);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a, b;
|
||||||
|
function f({
|
||||||
|
[function() {
|
||||||
|
if (++a)
|
||||||
|
return 42;
|
||||||
|
}()]: c
|
||||||
|
}) {}
|
||||||
|
f(b = f);
|
||||||
|
console.log(typeof b);
|
||||||
|
}
|
||||||
|
expect_stdout: "function"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user