dont gen visitor unless -visitor option

This commit is contained in:
Terence Parr 2012-02-16 17:45:57 -08:00
parent 2b9511f333
commit 44c0c8ca5e
2 changed files with 4 additions and 2 deletions

View File

@ -50,7 +50,9 @@ public class AltLabelStructDecl extends StructDecl {
@Override
public void addDispatchMethods(Rule r) {
super.addDispatchMethods(r);
dispatchMethods.add(new VisitorDispatchMethod(factory));
if ( factory.getGrammar().tool.gen_visitor ) {
dispatchMethods.add(new VisitorDispatchMethod(factory));
}
}
@Override

View File

@ -58,7 +58,7 @@ public class StructDecl extends Decl {
dispatchMethods = new ArrayList<DispatchMethod>();
dispatchMethods.add(new ListenerDispatchMethod(factory, true));
dispatchMethods.add(new ListenerDispatchMethod(factory, false));
if ( !r.hasAltSpecificContexts() ) {
if ( factory.getGrammar().tool.gen_visitor && !r.hasAltSpecificContexts() ) {
dispatchMethods.add(new VisitorDispatchMethod(factory));
}
}