aboutsummaryrefslogtreecommitdiff
path: root/lib/ast.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-08-21 12:37:05 +0300
committerMihai Bazon <mihai@bazon.net>2012-08-21 12:45:06 +0300
commit92bd53b513c6cf030d96ed627efc50dd1875ba85 (patch)
treeb2b52f56b0e3eb1c846e623d24ef558bd01b0f42 /lib/ast.js
parent159333f4c51e70a758160975a190646ff55bf66b (diff)
downloadtracifyjs-92bd53b513c6cf030d96ed627efc50dd1875ba85.tar.gz
tracifyjs-92bd53b513c6cf030d96ed627efc50dd1875ba85.zip
handle labels properly
(they can't be handled the same way as variables in a scope)
Diffstat (limited to 'lib/ast.js')
-rw-r--r--lib/ast.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 89a8237b..c38b3277 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -158,15 +158,13 @@ var AST_With = DEFNODE("With", "expression", {
var AST_Scope = DEFNODE("Scope", null, {
$documentation: "Base class for all statements introducing a lexical scope",
initialize: function() {
- this.labels = {}; // map name to AST_Label (labels defined in this scope)
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 this or from outer scope(s) that are accessed from this or inner scopes
+ 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
- this.lname = -1; // the current index for mangling labels
}
}, AST_BlockStatement);
@@ -568,7 +566,9 @@ function TreeWalker(callback) {
TreeWalker.prototype = {
_visit: function(node, descend) {
this.stack.push(node);
- var ret = this.visit(node, descend);
+ var ret = this.visit(node, function(){
+ descend.call(node);
+ });
if (!ret && descend) {
descend.call(node);
}