diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/scope.js | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/scope.js b/lib/scope.js index c74c494a..3de59b99 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -87,7 +87,7 @@ SymbolDef.prototype = { var def = scope.variables.get(name) || scope instanceof AST_Toplevel && scope.globals.get(name) || self.orig[0] instanceof AST_SymbolConst && find_if(function(def) { - return def.name == name && def !== self; + return def.name == name; }, scope.enclosed); if (def && def !== self) return def.redefined() || def; }, @@ -123,7 +123,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { // pass 1: setup scope chaining and handle definitions var self = this; - var const_names = null; var defun = null; var exported = false; var next_def_id = 0; @@ -202,7 +201,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { } else if (node instanceof AST_SymbolConst) { var def = scope.def_variable(node); def.defun = defun; - const_names.add(def.name, def); if (exported) def.exported = true; } else if (node instanceof AST_SymbolDefun) { var def = defun.def_function(node, tw.parent()); @@ -225,21 +223,13 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { function walk_scope(descend) { node.init_vars(scope); - var save_names = const_names; var save_defun = defun; var save_scope = scope; - if (node instanceof AST_Scope) { - const_names = new Dictionary(); - defun = node; - } + if (node instanceof AST_Scope) defun = node; scope = node; descend(); - if (node instanceof AST_Scope) const_names.each(function(defs, name) { - if (defs.length > 1 && !node.variables.has(name)) push_uniq(node.enclosed, defs[0]); - }); scope = save_scope; defun = save_defun; - const_names = save_names; } function entangle(defun, scope) { @@ -680,9 +670,6 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { if (def.scope.parent_scope.find_variable(sym.name)) return false; redef = scope.def_variable(sym); scope.to_mangle.push(redef); - } else if (redef.mangled_name) { - names_in_use(def.scope, options)[redef.mangled_name] = true; - return false; } redefined.push(def); def.references.forEach(reference); |