var s = def.scope;
do {
s = s.parent_scope;
- if (s.variables.has(node.name)) return false;
+ if (s.var_names()[node.name]) return false;
} while (s !== scope);
return true;
}) ? make_node(AST_Var, self, {
redefined: function() {
var scope = this.defun;
if (!scope) return;
- var def = scope.variables.get(this.name);
- if (!def && scope instanceof AST_Toplevel) def = scope.globals.get(this.name);
- if (!def || def === this) return;
- return def.redefined() || def;
+ var name = this.name;
+ var def = scope.variables.get(name)
+ || scope instanceof AST_Toplevel && scope.globals.get(name)
+ || this.orig[0] instanceof AST_SymbolConst && find_if(function(def) {
+ return def.name == name;
+ }, scope.enclosed);
+ if (def && def !== this) return def.redefined() || def;
},
unmangleable: function(options) {
return this.global && !options.toplevel