aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorkzc <zaxxon2011@gmail.com>2016-07-13 11:44:28 -0400
committerRichard van Velzen <rvanvelzen@experty.com>2016-07-15 13:18:14 +0200
commiteb63fece2f48be2be5ee1090d7bb94889a12fd80 (patch)
tree10f9450463652e1b82b32b6a4f9d401aee924083 /lib/scope.js
parent2d8af8947e3bf2daa51bdc199c504122563375d1 (diff)
downloadtracifyjs-eb63fece2f48be2be5ee1090d7bb94889a12fd80.tar.gz
tracifyjs-eb63fece2f48be2be5ee1090d7bb94889a12fd80.zip
Fix mangle with option keep_fnames=true for Safari.
Fixes: #1202
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 7ae87072..606a5a2f 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -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;
}
});