diff options
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/scope.js b/lib/scope.js index d5cadd34..6ad12616 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -183,17 +183,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ var func = null; var globals = self.globals = new Dictionary(); var tw = new TreeWalker(function(node, descend){ - function isModified(node, level) { - var parent = tw.parent(level); - if (parent instanceof AST_Unary && (parent.operator === "++" || parent.operator === "--") - || parent instanceof AST_Assign && parent.left === node - || parent instanceof AST_Call && parent.expression === node) { - return true; - } else if (parent instanceof AST_PropAccess && parent.expression === node) { - return isModified(parent, level + 1); - } - } - if (node instanceof AST_Lambda) { var prev_func = func; func = node; @@ -217,21 +206,16 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ node.scope.uses_arguments = true; } if (!sym) { - var g; if (globals.has(name)) { - g = globals.get(name); + sym = globals.get(name); } else { - g = new SymbolDef(self, globals.size(), node); - g.undeclared = true; - g.global = true; - globals.set(name, g); + sym = new SymbolDef(self, globals.size(), node); + sym.undeclared = true; + sym.global = true; + globals.set(name, sym); } - sym = g; } node.thedef = sym; - if (isModified(node, 0)) { - sym.modified = true; - } node.reference(options); return true; } |