@@ -5672,7 +5672,10 @@ merge(Compressor.prototype, {
|
|||||||
if (node instanceof AST_Call) {
|
if (node instanceof AST_Call) {
|
||||||
var exp = node.expression;
|
var exp = node.expression;
|
||||||
var tail = exp.tail_node();
|
var tail = exp.tail_node();
|
||||||
if (!(tail instanceof AST_LambdaExpression)) return walk_node_with_expr(node);
|
if (!(tail instanceof AST_LambdaExpression)) {
|
||||||
|
descend();
|
||||||
|
return mark_expression(exp);
|
||||||
|
}
|
||||||
if (exp !== tail) exp.expressions.slice(0, -1).forEach(function(node) {
|
if (exp !== tail) exp.expressions.slice(0, -1).forEach(function(node) {
|
||||||
node.walk(tw);
|
node.walk(tw);
|
||||||
});
|
});
|
||||||
@@ -5788,7 +5791,18 @@ merge(Compressor.prototype, {
|
|||||||
pop();
|
pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Sub) return walk_node_with_expr(node);
|
if (node instanceof AST_Sub) {
|
||||||
|
var exp = node.expression;
|
||||||
|
if (node.optional) {
|
||||||
|
exp.walk(tw);
|
||||||
|
push();
|
||||||
|
node.property.walk(tw);
|
||||||
|
pop();
|
||||||
|
} else {
|
||||||
|
descend();
|
||||||
|
}
|
||||||
|
return mark_expression(exp);
|
||||||
|
}
|
||||||
if (node instanceof AST_Switch) {
|
if (node instanceof AST_Switch) {
|
||||||
node.expression.walk(tw);
|
node.expression.walk(tw);
|
||||||
var save = segment;
|
var save = segment;
|
||||||
@@ -5888,10 +5902,9 @@ merge(Compressor.prototype, {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function walk_node_with_expr(node) {
|
function mark_expression(exp) {
|
||||||
descend();
|
|
||||||
if (compressor.option("ie")) {
|
if (compressor.option("ie")) {
|
||||||
var sym = root_expr(node.expression);
|
var sym = root_expr(exp);
|
||||||
if (sym instanceof AST_SymbolRef) sym.walk(tw);
|
if (sym instanceof AST_SymbolRef) sym.walk(tw);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -327,3 +327,29 @@ issue_5039: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=14"
|
node_version: ">=14"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5091: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f(a) {
|
||||||
|
var b = a.p;
|
||||||
|
var c;
|
||||||
|
b?.[c = "FAIL 2"];
|
||||||
|
return b || c;
|
||||||
|
}
|
||||||
|
console.log(f("FAIL 1") || "PASS");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function f(b) {
|
||||||
|
var b = b.p;
|
||||||
|
var c;
|
||||||
|
b?.[c = "FAIL 2"];
|
||||||
|
return b || c;
|
||||||
|
}
|
||||||
|
console.log(f("FAIL 1") || "PASS");
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=14"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user