diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-07 22:44:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 06:44:20 +0800 |
commit | fd4caf7a9cbfaa482d8cc77d2bc8cd00e8bc256a (patch) | |
tree | 75e5f2eedf3dbf809d76e419ab03d4dc62363a79 /lib/scope.js | |
parent | c44b6399c30b043f9bf687ce9b44458abc211d80 (diff) | |
download | tracifyjs-fd4caf7a9cbfaa482d8cc77d2bc8cd00e8bc256a.tar.gz tracifyjs-fd4caf7a9cbfaa482d8cc77d2bc8cd00e8bc256a.zip |
support generator functions (#4620)
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 5f10e33d..fb51486a 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -121,7 +121,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 (is_defun(node)) { + if (node instanceof AST_LambdaDefinition) { node.name.walk(tw); walk_scope(function() { node.argnames.forEach(function(argname) { @@ -439,7 +439,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 || is_defun(def.init)) def.init = init; + if (!def.init || def.init instanceof AST_LambdaDefinition) def.init = init; this.functions.set(symbol.name, def); return def; }); @@ -448,7 +448,7 @@ AST_BlockScope.DEFMETHOD("def_variable", function(symbol, init) { var def = this.variables.get(symbol.name); if (def) { def.orig.push(symbol); - if (is_function(def.init)) def.init = init; + if (def.init instanceof AST_LambdaExpression) def.init = init; } else { def = this.make_def(symbol, init); this.variables.set(symbol.name, def); |