Package icyllis.arc3d.compiler.analysis
Class TreeVisitor
java.lang.Object
icyllis.arc3d.compiler.analysis.TreeVisitor
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 TypeMethodDescriptionboolean
visitExpression
(@NonNull Expression expr) boolean
visitStatement
(@NonNull Statement stmt) boolean
visitTopLevelElement
(@NonNull TopLevelElement e)
-
Constructor Details
-
TreeVisitor
public TreeVisitor()
-
-
Method Details
-
visitTopLevelElement
-
visitExpression
-
visitStatement
-