mixin compiler::Visitor
compiler::Visitor
Vistor is used to walk the abstract syntax tree and visit key nodes. The walk for each node type entails:
- enter
- children
- exit
- visit
- enterBlock
-
virtual Void enterBlock(Block block)
Callback when entering a block.
- enterFieldDef
-
virtual Void enterFieldDef(FieldDef def)
Callback when entering a field definition.
- enterFinally
-
virtual Void enterFinally(TryStmt stmt)
Callback when entering a finally block
- enterMethodDef
-
virtual Void enterMethodDef(MethodDef def)
Callback when entering a method.
- enterStmt
-
virtual Void enterStmt(Stmt stmt)
Callback when entering a stmt.
- enterTypeDef
-
virtual Void enterTypeDef(TypeDef def)
Callback when entering a type definition.
- enterUnit
-
virtual Void enterUnit(CompilationUnit unit)
Callback when entering a compilation unit.
- exitBlock
-
virtual Void exitBlock(Block block)
Callback when exiting a block.
- exitFieldDef
-
virtual Void exitFieldDef(FieldDef def)
Callback when exiting a field definition.
- exitFinally
-
virtual Void exitFinally(TryStmt stmt)
Callback when exiting a finally block
- exitMethodDef
-
virtual Void exitMethodDef(MethodDef def)
Callback when exiting a method.
- exitStmt
-
virtual Void exitStmt(Stmt stmt)
Callback when exiting a stmt.
- exitTypeDef
-
virtual Void exitTypeDef(TypeDef def)
Callback when exiting a type definition.
- exitUnit
-
virtual Void exitUnit(CompilationUnit unit)
Callback when existing a compilation unit.
- visitBlock
-
virtual Void visitBlock(Block block)
Callback when visiting a block.
- visitExpr
-
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.
- visitFieldDef
-
virtual Void visitFieldDef(FieldDef def)
Callback when visiting a field definition.
- visitMethodDef
-
virtual Void visitMethodDef(MethodDef def)
Callback when visiting a method.
- visitStmt
-
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.
- visitTypeDef
-
virtual Void visitTypeDef(TypeDef def)
Callback when visiting a type definition.
- walk
-
Void walk(Compiler c, VisitDepth depth)
Peform a walk of the abstract syntax tree down to the specified depth.