Fix mangle with option keep_fnames=true for Safari.

Fixes: #1202
This commit is contained in:
kzc
2016-07-13 11:44:28 -04:00
committed by Richard van Velzen
parent 2d8af8947e
commit eb63fece2f
2 changed files with 57 additions and 1 deletions

View File

@@ -314,9 +314,13 @@ AST_Function.DEFMETHOD("next_mangled", function(options, def){
// a function expression's argument cannot shadow the function expression's name
var tricky_def = def.orig[0] instanceof AST_SymbolFunarg && this.name && this.name.definition();
// the function's mangled_name is null when keep_fnames is true
var tricky_name = tricky_def ? tricky_def.mangled_name || tricky_def.name : null;
while (true) {
var name = AST_Lambda.prototype.next_mangled.call(this, options, def);
if (!(tricky_def && tricky_def.mangled_name == name))
if (!tricky_name || tricky_name != name)
return name;
}
});