diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-08-21 12:55:56 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-08-21 13:53:16 +0300 |
commit | 7ae1c600a24e2f43feb839c5fd1625f6261751b5 (patch) | |
tree | abe06f041accc5dc0a4d277ae29612f2ee5af080 /lib/ast.js | |
parent | 92bd53b513c6cf030d96ed627efc50dd1875ba85 (diff) | |
download | tracifyjs-7ae1c600a24e2f43feb839c5fd1625f6261751b5.tar.gz tracifyjs-7ae1c600a24e2f43feb839c5fd1625f6261751b5.zip |
some reorganization
(moved pretty much everything that relates to scope in scope.js, added a
module for NodeJS that can be used with require() and exports everything.)
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -156,16 +156,7 @@ var AST_With = DEFNODE("With", "expression", { /* -----[ scope and functions ]----- */ var AST_Scope = DEFNODE("Scope", null, { - $documentation: "Base class for all statements introducing a lexical scope", - initialize: function() { - this.variables = {}; // map name to AST_SymbolVar (variables defined in this scope; includes functions) - this.functions = {}; // map name to AST_SymbolDefun (functions defined in this scope) - this.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement - this.uses_eval = false; // will be set to true if this or nested scope uses the global `eval` - this.parent_scope = null; // the parent scope - this.enclosed = []; // a list of variables from this or outer scope(s) that are referenced from this or inner scopes - this.cname = -1; // the current index for mangling functions/variables - } + $documentation: "Base class for all statements introducing a lexical scope" }, AST_BlockStatement); var AST_Toplevel = DEFNODE("Toplevel", null, { @@ -174,10 +165,6 @@ var AST_Toplevel = DEFNODE("Toplevel", null, { var AST_Lambda = DEFNODE("Lambda", "name argnames", { $documentation: "Base class for functions", - initialize: function() { - AST_Scope.prototype.initialize.call(this); - this.uses_arguments = false; - }, _walk: function(visitor) { return visitor._visit(this, function(){ if (this.name) this.name._walk(visitor); @@ -479,10 +466,7 @@ var AST_ObjectGetter = DEFNODE("ObjectGetter", null, { var AST_Symbol = DEFNODE("Symbol", "scope name", { }); -var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "references", { - initialize: function() { - this.references = []; - } +var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", null, { }, AST_Symbol); var AST_SymbolVar = DEFNODE("SymbolVar", null, { |