@@ -1984,9 +1984,12 @@ merge(Compressor.prototype, {
|
|||||||
if (expr.name instanceof AST_SymbolFunarg) {
|
if (expr.name instanceof AST_SymbolFunarg) {
|
||||||
var index = compressor.self().argnames.indexOf(expr.name);
|
var index = compressor.self().argnames.indexOf(expr.name);
|
||||||
var args = compressor.parent().args;
|
var args = compressor.parent().args;
|
||||||
if (args[index]) args[index] = make_node(AST_Number, args[index], {
|
if (args[index]) {
|
||||||
|
args[index] = make_node(AST_Number, args[index], {
|
||||||
value: 0
|
value: 0
|
||||||
});
|
});
|
||||||
|
expr.name.definition().fixed = false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var end = hit_stack.length - 1;
|
var end = hit_stack.length - 1;
|
||||||
|
|||||||
@@ -8391,3 +8391,59 @@ issue_4040: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4047_1: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
evaluate: true,
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
sequences: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var b = 1;
|
||||||
|
console.log(+function(a) {
|
||||||
|
b = a;
|
||||||
|
(a >>= 0) && console.log("PASS");
|
||||||
|
}(--b + (0 !== typeof A)));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var b = 1;
|
||||||
|
var a;
|
||||||
|
console.log((a = --b + ((a = 0) !== typeof A), +void ((a >>= 0) && console.log("PASS"))));
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"PASS",
|
||||||
|
"NaN",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_4047_2: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
evaluate: true,
|
||||||
|
inline: true,
|
||||||
|
passes: 2,
|
||||||
|
reduce_vars: true,
|
||||||
|
sequences: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var b = 1;
|
||||||
|
console.log(+function(a) {
|
||||||
|
b = a;
|
||||||
|
(a >>= 0) && console.log("PASS");
|
||||||
|
}(--b + (0 !== typeof A)));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a;
|
||||||
|
console.log((a = +(0 !== typeof A), +void ((a >>= 0) && console.log("PASS"))));
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"PASS",
|
||||||
|
"NaN",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user