Interface SourceVisitor<T>
-
- Type Parameters:
T- the return type of visit methods
- All Known Implementing Classes:
AbstractSourceVisitor,ASTPrinter,SideEffectDetector,SourceEmitter
public interface SourceVisitor<T>Visitor interface for traversing source AST nodes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default TvisitAnnotationExpr(AnnotationExpr expr)Visits an annotation use.TvisitArrayAccess(ArrayAccessExpr expr)Visits an array element access.TvisitArrayInit(ArrayInitExpr expr)Visits a braced array initializer.TvisitArrayType(ArraySourceType type)Visits an array type.TvisitBinary(BinaryExpr expr)Visits a binary operation.TvisitBlock(BlockStmt stmt)Visits a braced block.TvisitBreak(BreakStmt stmt)Visits a break statement.TvisitCast(CastExpr expr)Visits a cast.TvisitClass(ClassExpr expr)Visits a class literal.default TvisitClassDecl(ClassDecl decl)Visits a class declaration.default TvisitCompilationUnit(CompilationUnit cu)Visits a compilation unit.default TvisitConstructorDecl(ConstructorDecl decl)Visits a constructor declaration.TvisitContinue(ContinueStmt stmt)Visits a continue statement.TvisitDoWhile(DoWhileStmt stmt)Visits a do-while loop.TvisitDynamicConstant(DynamicConstantExpr expr)Visits a dynamically computed constant.default TvisitEnumConstantDecl(EnumConstantDecl decl)Visits one enum constant.default TvisitEnumDecl(EnumDecl decl)Visits an enum declaration.TvisitExprStmt(ExprStmt stmt)Visits an expression used as a statement.TvisitFieldAccess(FieldAccessExpr expr)Visits a field access.default TvisitFieldDecl(FieldDecl decl)Visits a field declaration.TvisitFor(ForStmt stmt)Visits a counted for loop.TvisitForEach(ForEachStmt stmt)Visits an enhanced for loop.TvisitIf(IfStmt stmt)Visits an if statement.default TvisitImportDecl(ImportDecl decl)Visits an import declaration.TvisitInstanceOf(InstanceOfExpr expr)Visits aninstanceoftest.default TvisitInterfaceDecl(InterfaceDecl decl)Visits an interface declaration.TvisitInvokeDynamic(InvokeDynamicExpr expr)Visits an invokedynamic call site.TvisitIRRegion(IRRegionStmt stmt)Visits a region of control flow that stayed in IR form because it could not be structured.TvisitLabeled(LabeledStmt stmt)Visits a labeled statement.TvisitLambda(LambdaExpr expr)Visits a lambda expression.TvisitLiteral(LiteralExpr expr)Visits a literal.TvisitMethodCall(MethodCallExpr expr)Visits a method call.default TvisitMethodDecl(MethodDecl decl)Visits a method declaration.TvisitMethodRef(MethodRefExpr expr)Visits a method reference.TvisitNew(NewExpr expr)Visits an object allocation.TvisitNewArray(NewArrayExpr expr)Visits an array allocation.default TvisitParameterDecl(ParameterDecl decl)Visits a method or constructor parameter.TvisitPrimitiveType(PrimitiveSourceType type)Visits a primitive type.TvisitReferenceType(ReferenceSourceType type)Visits a class or interface type.TvisitReturn(ReturnStmt stmt)Visits a return statement.TvisitSuper(SuperExpr expr)Visits asuperreference.TvisitSwitch(SwitchStmt stmt)Visits a switch statement.default TvisitSwitchExpr(SwitchExpr expr)Default so existing visitors need no change; only the source emitter overrides it.TvisitSynchronized(SynchronizedStmt stmt)Visits a synchronized block.TvisitTernary(TernaryExpr expr)Visits a ternary conditional.TvisitThis(ThisExpr expr)Visits athisreference.TvisitThrow(ThrowStmt stmt)Visits a throw statement.TvisitTryCatch(TryCatchStmt stmt)Visits a try statement, with its catch clauses and finally block.TvisitUnary(UnaryExpr expr)Visits a unary operation.TvisitVarDecl(VarDeclStmt stmt)Visits a local variable declaration.TvisitVarRef(VarRefExpr expr)Visits a variable reference.TvisitVoidType(VoidSourceType type)Visits the void type.TvisitWhile(WhileStmt stmt)Visits a while loop.
-
-
-
Method Detail
-
visitCompilationUnit
default T visitCompilationUnit(CompilationUnit cu)
Visits a compilation unit.- Parameters:
cu- the compilation unit node- Returns:
- the visitor's result, null unless overridden
-
visitImportDecl
default T visitImportDecl(ImportDecl decl)
Visits an import declaration.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitClassDecl
default T visitClassDecl(ClassDecl decl)
Visits a class declaration.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitInterfaceDecl
default T visitInterfaceDecl(InterfaceDecl decl)
Visits an interface declaration.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitEnumDecl
default T visitEnumDecl(EnumDecl decl)
Visits an enum declaration.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitEnumConstantDecl
default T visitEnumConstantDecl(EnumConstantDecl decl)
Visits one enum constant.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitMethodDecl
default T visitMethodDecl(MethodDecl decl)
Visits a method declaration.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitConstructorDecl
default T visitConstructorDecl(ConstructorDecl decl)
Visits a constructor declaration.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitFieldDecl
default T visitFieldDecl(FieldDecl decl)
Visits a field declaration.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitParameterDecl
default T visitParameterDecl(ParameterDecl decl)
Visits a method or constructor parameter.- Parameters:
decl- the declaration node- Returns:
- the visitor's result, null unless overridden
-
visitAnnotationExpr
default T visitAnnotationExpr(AnnotationExpr expr)
Visits an annotation use.- Parameters:
expr- the annotation node- Returns:
- the visitor's result, null unless overridden
-
visitBlock
T visitBlock(BlockStmt stmt)
Visits a braced block.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitIf
T visitIf(IfStmt stmt)
Visits an if statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitWhile
T visitWhile(WhileStmt stmt)
Visits a while loop.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitDoWhile
T visitDoWhile(DoWhileStmt stmt)
Visits a do-while loop.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitFor
T visitFor(ForStmt stmt)
Visits a counted for loop.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitForEach
T visitForEach(ForEachStmt stmt)
Visits an enhanced for loop.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitSwitch
T visitSwitch(SwitchStmt stmt)
Visits a switch statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitTryCatch
T visitTryCatch(TryCatchStmt stmt)
Visits a try statement, with its catch clauses and finally block.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitReturn
T visitReturn(ReturnStmt stmt)
Visits a return statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitThrow
T visitThrow(ThrowStmt stmt)
Visits a throw statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitVarDecl
T visitVarDecl(VarDeclStmt stmt)
Visits a local variable declaration.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitExprStmt
T visitExprStmt(ExprStmt stmt)
Visits an expression used as a statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitSynchronized
T visitSynchronized(SynchronizedStmt stmt)
Visits a synchronized block.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitLabeled
T visitLabeled(LabeledStmt stmt)
Visits a labeled statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitBreak
T visitBreak(BreakStmt stmt)
Visits a break statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitContinue
T visitContinue(ContinueStmt stmt)
Visits a continue statement.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitIRRegion
T visitIRRegion(IRRegionStmt stmt)
Visits a region of control flow that stayed in IR form because it could not be structured.- Parameters:
stmt- the statement node- Returns:
- the visitor's result
-
visitLiteral
T visitLiteral(LiteralExpr expr)
Visits a literal.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitVarRef
T visitVarRef(VarRefExpr expr)
Visits a variable reference.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitFieldAccess
T visitFieldAccess(FieldAccessExpr expr)
Visits a field access.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitArrayAccess
T visitArrayAccess(ArrayAccessExpr expr)
Visits an array element access.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitMethodCall
T visitMethodCall(MethodCallExpr expr)
Visits a method call.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitNew
T visitNew(NewExpr expr)
Visits an object allocation.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitNewArray
T visitNewArray(NewArrayExpr expr)
Visits an array allocation.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitArrayInit
T visitArrayInit(ArrayInitExpr expr)
Visits a braced array initializer.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitBinary
T visitBinary(BinaryExpr expr)
Visits a binary operation.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitUnary
T visitUnary(UnaryExpr expr)
Visits a unary operation.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitCast
T visitCast(CastExpr expr)
Visits a cast.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitInstanceOf
T visitInstanceOf(InstanceOfExpr expr)
Visits aninstanceoftest.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitTernary
T visitTernary(TernaryExpr expr)
Visits a ternary conditional.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitSwitchExpr
default T visitSwitchExpr(SwitchExpr expr)
Default so existing visitors need no change; only the source emitter overrides it.- Parameters:
expr- the switch expression to visit- Returns:
- the visitor result, null unless overridden
-
visitLambda
T visitLambda(LambdaExpr expr)
Visits a lambda expression.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitMethodRef
T visitMethodRef(MethodRefExpr expr)
Visits a method reference.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitThis
T visitThis(ThisExpr expr)
Visits athisreference.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitSuper
T visitSuper(SuperExpr expr)
Visits asuperreference.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitClass
T visitClass(ClassExpr expr)
Visits a class literal.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitDynamicConstant
T visitDynamicConstant(DynamicConstantExpr expr)
Visits a dynamically computed constant.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitInvokeDynamic
T visitInvokeDynamic(InvokeDynamicExpr expr)
Visits an invokedynamic call site.- Parameters:
expr- the expression node- Returns:
- the visitor's result
-
visitPrimitiveType
T visitPrimitiveType(PrimitiveSourceType type)
Visits a primitive type.- Parameters:
type- the type node- Returns:
- the visitor's result
-
visitReferenceType
T visitReferenceType(ReferenceSourceType type)
Visits a class or interface type.- Parameters:
type- the type node- Returns:
- the visitor's result
-
visitArrayType
T visitArrayType(ArraySourceType type)
Visits an array type.- Parameters:
type- the type node- Returns:
- the visitor's result
-
visitVoidType
T visitVoidType(VoidSourceType type)
Visits the void type.- Parameters:
type- the type node- Returns:
- the visitor's result
-
-