@@ -741,6 +741,11 @@ merge(Compressor.prototype, {
|
|||||||
if (j < 0) return value;
|
if (j < 0) return value;
|
||||||
return iife.args[j] || make_node(AST_Undefined, iife);
|
return iife.args[j] || make_node(AST_Undefined, iife);
|
||||||
};
|
};
|
||||||
|
d.fixed.reduce_arg = function() {
|
||||||
|
var j = fn.argnames.indexOf(arg);
|
||||||
|
if (j < 0 || j >= iife.args.length) return;
|
||||||
|
iife.args[j] = make_node(AST_Number, iife.args[j], { value: 0 });
|
||||||
|
};
|
||||||
tw.loop_ids[d.id] = tw.in_loop;
|
tw.loop_ids[d.id] = tw.in_loop;
|
||||||
mark(tw, d, true);
|
mark(tw, d, true);
|
||||||
} else {
|
} else {
|
||||||
@@ -7566,6 +7571,7 @@ merge(Compressor.prototype, {
|
|||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
value = fixed.optimize(compressor);
|
value = fixed.optimize(compressor);
|
||||||
|
if (def.fixed.reduce_arg) def.fixed.reduce_arg();
|
||||||
}
|
}
|
||||||
def.replaced++;
|
def.replaced++;
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -7068,3 +7068,30 @@ issue_3880: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3894: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function log(msg) {
|
||||||
|
console.log(msg ? "FAIL" : "PASS");
|
||||||
|
}
|
||||||
|
var a;
|
||||||
|
(function(b) {
|
||||||
|
a = 0,
|
||||||
|
log(b);
|
||||||
|
})(-0);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function log(msg) {
|
||||||
|
console.log(msg ? "FAIL" : "PASS");
|
||||||
|
}
|
||||||
|
var a;
|
||||||
|
void log(-(a = 0));
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user