diff options
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/scope.js b/lib/scope.js index c1bbc086..6c521bcc 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -112,7 +112,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { var next_def_id = 0; var scope = self.parent_scope = null; var tw = new TreeWalker(function(node, descend) { - if (node instanceof AST_AsyncDefun || node instanceof AST_Defun) { + if (is_defun(node)) { node.name.walk(tw); walk_scope(function() { node.argnames.forEach(function(argname) { @@ -397,7 +397,7 @@ AST_BlockScope.DEFMETHOD("find_variable", function(name) { AST_BlockScope.DEFMETHOD("def_function", function(symbol, init) { var def = this.def_variable(symbol, init); - if (!def.init || def.init instanceof AST_Defun) def.init = init; + if (!def.init || is_defun(def.init)) def.init = init; this.functions.set(symbol.name, def); return def; }); @@ -406,7 +406,7 @@ AST_BlockScope.DEFMETHOD("def_variable", function(symbol, init) { var def = this.variables.get(symbol.name); if (def) { def.orig.push(symbol); - if (def.init instanceof AST_Function) def.init = init; + if (is_function(def.init)) def.init = init; } else { def = this.make_def(symbol, init); this.variables.set(symbol.name, def); |