Skip to content

AstVisitor

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

Implementations

  • 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.

process

R process(
  AstNode node,
  C context)

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

visitQuery

R visitQuery(
  Query node,
  C context)

visitQuery visitStatement.


visitQuery is used when:

  • Query is requested to accept

visitStatement

R visitStatement(
  Statement node,
  C context)

visitStatement visitNode.

visitNode

R visitNode(
  AstNode node,
  C context)

visitNode returns the defaultResult.