aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js32
1 files changed, 18 insertions, 14 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 103f47f1..0369b63d 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -10173,22 +10173,26 @@ merge(Compressor.prototype, {
var argname = fn.argnames[index];
if (def.deleted && def.deleted[index]) {
argname = null;
- } else if (argname && !(argname instanceof AST_SymbolFunarg)) {
- argname = null;
- } else if (argname && (compressor.has_directive("use strict")
- || fn.name
- || !(fn_parent instanceof AST_Call && index < fn_parent.args.length)
- || !all(fn.argnames, function(argname) {
- return argname instanceof AST_SymbolFunarg;
- }))) {
- var arg_def = argname.definition();
- if (!compressor.option("reduce_vars")
- || def.reassigned
- || arg_def.assignments
- || arg_def.orig.length > 1) {
+ } else if (argname) {
+ var arg_def;
+ if (!(argname instanceof AST_SymbolFunarg)) {
argname = null;
+ } else if (expr.scope.find_variable(argname.name) !== (arg_def = argname.definition())) {
+ argname = null;
+ } else if (compressor.has_directive("use strict")
+ || fn.name
+ || !(fn_parent instanceof AST_Call && index < fn_parent.args.length)
+ || !all(fn.argnames, function(argname) {
+ return argname instanceof AST_SymbolFunarg;
+ })) {
+ if (!compressor.option("reduce_vars")
+ || def.reassigned
+ || arg_def.assignments
+ || arg_def.orig.length > 1) {
+ argname = null;
+ }
}
- } else if (!argname && index < fn.argnames.length + 5 && compressor.drop_fargs(fn, fn_parent)) {
+ } else if (index < fn.argnames.length + 5 && compressor.drop_fargs(fn, fn_parent)) {
while (index >= fn.argnames.length) {
argname = fn.make_var(AST_SymbolFunarg, fn, "argument_" + fn.argnames.length);
fn.argnames.push(argname);