Package icyllis.arc3d.compiler.tree
Class TreeVisitor
java.lang.Object
icyllis.arc3d.compiler.tree.TreeVisitor
- Direct Known Subclasses:
SymbolUsage
Utility class to visit every element, statement, and expression in a program IR.
This is intended for simple analysis and accumulation, where custom visitation behavior is only
needed for a limited set of expression kinds.
Subclasses should override visitExpression/visitStatement/visitElement as needed and intercept elements of interest. They can then invoke the base class's function to visit all sub expressions. They can also choose not to call the base function to arrest recursion, or implement custom recursion.
The visit functions return a bool that determines how the default implementation recursions. Once any visit call returns true, the default behavior stops recursion and propagates true up the stack.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvisitBinary(BinaryExpression expr) booleanvisitBlock(BlockStatement stmt) booleanvisitBreak(BreakStatement stmt) booleanbooleanbooleanbooleanvisitDiscard(DiscardStatement stmt) booleanvisitEmpty(EmptyStatement stmt) protected booleanvisitExpression(Expression expr) Fallback method for any expression kind that has not been overridden.booleanbooleanvisitFieldAccess(FieldAccess expr) booleanvisitForLoop(ForLoop stmt) booleanbooleanvisitFunctionDefinition(FunctionDefinition definition) booleanvisitFunctionPrototype(FunctionPrototype prototype) booleanbooleanvisitGlobalVariableDecl(GlobalVariableDecl variableDecl) booleanvisitIf(IfStatement stmt) booleanvisitIndex(IndexExpression expr) booleanvisitInterfaceBlock(InterfaceBlock interfaceBlock) booleanvisitLiteral(Literal expr) booleanbooleanvisitPrefix(PrefixExpression expr) booleanvisitReturn(ReturnStatement stmt) protected booleanvisitStatement(Statement stmt) Fallback method for any statement kind that has not been overridden.booleanvisitStructDefinition(StructDefinition structDefinition) booleanvisitSwitch(SwitchStatement stmt) booleanvisitSwitchCase(SwitchCase stmt) booleanvisitSwizzle(Swizzle expr) protected booleanFallback method for any element kind that has not been overridden.booleanbooleanvisitVariableDecl(VariableDecl variableDecl) boolean
-
Constructor Details
-
TreeVisitor
public TreeVisitor()
-
-
Method Details
-
visitFunctionPrototype
-
visitFunctionDefinition
-
visitGlobalVariableDecl
-
visitInterfaceBlock
-
visitStructDefinition
-
visitTopLevelElement
Fallback method for any element kind that has not been overridden. -
visitFunctionReference
-
visitVariableReference
-
visitTypeReference
-
visitLiteral
-
visitFieldAccess
-
visitIndex
-
visitPostfix
-
visitPrefix
-
visitBinary
-
visitConditional
-
visitSwizzle
-
visitFunctionCall
-
visitConstructorCall
-
visitExpression
Fallback method for any expression kind that has not been overridden. -
visitBlock
-
visitBreak
-
visitContinue
-
visitDiscard
-
visitEmpty
-
visitExpression
-
visitForLoop
-
visitIf
-
visitReturn
-
visitSwitch
-
visitSwitchCase
-
visitVariableDecl
-
visitStatement
Fallback method for any statement kind that has not been overridden.
-