|| (!(options && options.eval) && (this.scope.uses_eval || this.scope.uses_with));
},
mangle: function(options) {
- if (!this.mangled_name && !this.unmangleable(options))
- this.mangled_name = this.scope.next_mangled(options);
+ if (!this.mangled_name && !this.unmangleable(options)) {
+ var s = this.scope;
+ if (this.orig[0] instanceof AST_SymbolLambda && !options.screw_ie)
+ s = s.parent_scope;
+ this.mangled_name = s.next_mangled(options);
+ }
}
};
-AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
- options = defaults(options, {
- screw_ie: false
- });
+AST_Toplevel.DEFMETHOD("figure_out_scope", function(){
// This does what ast_add_scope did in UglifyJS v1.
//
// Part of it could be done at parse time, but it would complicate
node.init_scope_vars();
}
if (node instanceof AST_SymbolLambda) {
- if (options.screw_ie) {
- scope.def_function(node);
- } else {
- // https://github.com/mishoo/UglifyJS2/issues/24 — MSIE
- // leaks function expression names into the containing
- // scope. Don't like this fix but seems we can't do any
- // better. IE: please die. Please!
- (node.scope = scope.parent_scope).def_function(node);
- }
+ scope.def_function(node);
}
else if (node instanceof AST_SymbolDefun) {
// Careful here, the scope where this should be defined is
});
AST_Scope.DEFMETHOD("next_mangled", function(options){
- var ext = this.enclosed, n = ext.length;
+ var ext = this.enclosed;
out: while (true) {
var m = base54(++this.cname);
if (!is_identifier(m)) continue; // skip over "do"
// we must ensure that the mangled name does not shadow a name
// from some parent scope that is referenced in this or in
// inner scopes.
- for (var i = n; --i >= 0;) {
+ for (var i = ext.length; --i >= 0;) {
var sym = ext[i];
var name = sym.mangled_name || (sym.unmangleable(options) && sym.name);
if (m == name) continue out;
except : [],
eval : false,
sort : false,
- toplevel : false
+ toplevel : false,
+ screw_ie : false
});
});