handle labels properly
(they can't be handled the same way as variables in a scope)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user