Fan

 

mixin

compiler::Visitor

sys::Obj
  compiler::Visitor

Vistor is used to walk the abstract syntax tree and visit key nodes. The walk for each node type entails:

  1. enter
  2. children
  3. exit
  4. visit

Slots

enterBlockSource

virtual Void enterBlock(Block block)

Callback when entering a block.

enterFieldDefSource

virtual Void enterFieldDef(FieldDef def)

Callback when entering a field definition.

enterFinallySource

virtual Void enterFinally(TryStmt stmt)

Callback when entering a finally block

enterMethodDefSource

virtual Void enterMethodDef(MethodDef def)

Callback when entering a method.

enterStmtSource

virtual Void enterStmt(Stmt stmt)

Callback when entering a stmt.

enterSymbolDefSource

virtual Void enterSymbolDef(SymbolDef def)

Callback when entering a symbol definition.

enterTypeDefSource

virtual Void enterTypeDef(TypeDef def)

Callback when entering a type definition.

enterUnitSource

virtual Void enterUnit(CompilationUnit unit)

Callback when entering a compilation unit.

exitBlockSource

virtual Void exitBlock(Block block)

Callback when exiting a block.

exitFieldDefSource

virtual Void exitFieldDef(FieldDef def)

Callback when exiting a field definition.

exitFinallySource

virtual Void exitFinally(TryStmt stmt)

Callback when exiting a finally block

exitMethodDefSource

virtual Void exitMethodDef(MethodDef def)

Callback when exiting a method.

exitStmtSource

virtual Void exitStmt(Stmt stmt)

Callback when exiting a stmt.

exitSymbolDefSource

virtual Void exitSymbolDef(SymbolDef def)

Callback when exiting a symbol definition.

exitTypeDefSource

virtual Void exitTypeDef(TypeDef def)

Callback when exiting a type definition.

exitUnitSource

virtual Void exitUnit(CompilationUnit unit)

Callback when existing a compilation unit.

visitBlockSource

virtual Void visitBlock(Block block)

Callback when visiting a block.

visitExprSource

virtual Expr visitExpr(Expr expr)

Call to visit an expression. Return expr or a new expression if doing a replacement for the expression in the abstract syntax tree.

visitFieldDefSource

virtual Void visitFieldDef(FieldDef def)

Callback when visiting a field definition.

visitMethodDefSource

virtual Void visitMethodDef(MethodDef def)

Callback when visiting a method.

visitStmtSource

virtual Stmt[]? visitStmt(Stmt stmt)

Callback when visiting a stmt. Return a list to replace the statement with new statements, or return null to keep existing statement.

visitTypeDefSource

virtual Void visitTypeDef(TypeDef def)

Callback when visiting a type definition.

walkSource

Void walk(Compiler c, VisitDepth depth)

Peform a walk of the abstract syntax tree down to the specified depth.