fix inline on duplicate argument names (#2698)
This commit is contained in:
@@ -4012,7 +4012,7 @@ merge(Compressor.prototype, {
|
||||
for (var len = fn.argnames.length, i = len; --i >= 0;) {
|
||||
var name = fn.argnames[i];
|
||||
var value = self.args[i];
|
||||
if (name.__unused) {
|
||||
if (name.__unused || scope.var_names()[name.name]) {
|
||||
if (value) {
|
||||
expressions.unshift(value);
|
||||
}
|
||||
|
||||
@@ -1646,3 +1646,28 @@ issue_2663_3: {
|
||||
"reset",
|
||||
]
|
||||
}
|
||||
|
||||
duplicate_argnames: {
|
||||
options = {
|
||||
inline: true,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
var a = "PASS";
|
||||
function f(b, b, b) {
|
||||
b && (a = "FAIL");
|
||||
}
|
||||
f(0, console);
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
var a = "PASS";
|
||||
console, b && (a = "FAIL");
|
||||
var b;
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user