Skip to content


AstVisitor<R, C> is an abstraction of AST visitors.


  • AstSanitizer.RewriterPlugin
  • DefaultTraversalVisitor
  • ScalablePushUtil.SourceFinder
  • SqlFormatter.Formatter
  • StatementRewriter.Rewriter

Creating Instance

AstVisitor takes the following to be created:

Abstract Class

AstVisitor is an abstract class and cannot be created directly. It is created indirectly for the concrete AstVisitors.

Default Result

R defaultResult

AstVisitor can be given defaultResult value when created. Unless given, defaultResult value is undefined (null).

defaultResult is the default result of visitNode.


R process(
  AstNode node,
  C context)

process requests the given AstNode to accept this AstVisitor (and the context).


R visitQuery(
  Query node,
  C context)

visitQuery visitStatement.

visitQuery is used when:

  • Query is requested to accept


R visitStatement(
  Statement node,
  C context)

visitStatement visitNode.


R visitNode(
  AstNode node,
  C context)

visitNode returns the defaultResult.