forked from jasder/antlr
clarify javascript visitor code
This commit is contained in:
parent
d9490e16da
commit
c50b10f865
|
@ -88,10 +88,11 @@ function ParseTreeVisitor() {
|
|||
|
||||
ParseTreeVisitor.prototype.visit = function(ctx) {
|
||||
if (Utils.isArray(ctx)) {
|
||||
var self = this;
|
||||
return ctx.map(function(child) { return visitAtom(self, child)});
|
||||
return ctx.map(function(child) {
|
||||
return ctx.accept(this);
|
||||
}, this);
|
||||
} else {
|
||||
return visitAtom(this, ctx);
|
||||
return ctx.accept(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -106,10 +107,6 @@ ParseTreeVisitor.prototype.visitErrorNode = function(node) {
|
|||
};
|
||||
|
||||
|
||||
var visitAtom = function(visitor, ctx) {
|
||||
return ctx.accept(visitor);
|
||||
};
|
||||
|
||||
function ParseTreeListener() {
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue