Class AbstractSourceVisitor<T>

  • Type Parameters:
    T - the return type of visit methods
    All Implemented Interfaces:
    SourceVisitor<T>
    Direct Known Subclasses:
    SideEffectDetector

    public abstract class AbstractSourceVisitor<T>
    extends Object
    implements SourceVisitor<T>
    Base SourceVisitor whose visit methods walk the whole tree and return defaultValue().
    • Constructor Detail

      • AbstractSourceVisitor

        public AbstractSourceVisitor()
    • Method Detail

      • visitBlock

        public T visitBlock​(BlockStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a braced block.
        Specified by:
        visitBlock in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitIf

        public T visitIf​(IfStmt stmt)
        Description copied from interface: SourceVisitor
        Visits an if statement.
        Specified by:
        visitIf in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitWhile

        public T visitWhile​(WhileStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a while loop.
        Specified by:
        visitWhile in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitDoWhile

        public T visitDoWhile​(DoWhileStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a do-while loop.
        Specified by:
        visitDoWhile in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitFor

        public T visitFor​(ForStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a counted for loop.
        Specified by:
        visitFor in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitForEach

        public T visitForEach​(ForEachStmt stmt)
        Description copied from interface: SourceVisitor
        Visits an enhanced for loop.
        Specified by:
        visitForEach in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitSwitch

        public T visitSwitch​(SwitchStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a switch statement.
        Specified by:
        visitSwitch in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitTryCatch

        public T visitTryCatch​(TryCatchStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a try statement, with its catch clauses and finally block.
        Specified by:
        visitTryCatch in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitReturn

        public T visitReturn​(ReturnStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a return statement.
        Specified by:
        visitReturn in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitThrow

        public T visitThrow​(ThrowStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a throw statement.
        Specified by:
        visitThrow in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitVarDecl

        public T visitVarDecl​(VarDeclStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a local variable declaration.
        Specified by:
        visitVarDecl in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitExprStmt

        public T visitExprStmt​(ExprStmt stmt)
        Description copied from interface: SourceVisitor
        Visits an expression used as a statement.
        Specified by:
        visitExprStmt in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitLabeled

        public T visitLabeled​(LabeledStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a labeled statement.
        Specified by:
        visitLabeled in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitBreak

        public T visitBreak​(BreakStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a break statement.
        Specified by:
        visitBreak in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitContinue

        public T visitContinue​(ContinueStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a continue statement.
        Specified by:
        visitContinue in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitIRRegion

        public T visitIRRegion​(IRRegionStmt stmt)
        Description copied from interface: SourceVisitor
        Visits a region of control flow that stayed in IR form because it could not be structured.
        Specified by:
        visitIRRegion in interface SourceVisitor<T>
        Parameters:
        stmt - the statement node
        Returns:
        the visitor's result
      • visitLiteral

        public T visitLiteral​(LiteralExpr expr)
        Description copied from interface: SourceVisitor
        Visits a literal.
        Specified by:
        visitLiteral in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitVarRef

        public T visitVarRef​(VarRefExpr expr)
        Description copied from interface: SourceVisitor
        Visits a variable reference.
        Specified by:
        visitVarRef in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitNew

        public T visitNew​(NewExpr expr)
        Description copied from interface: SourceVisitor
        Visits an object allocation.
        Specified by:
        visitNew in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitNewArray

        public T visitNewArray​(NewArrayExpr expr)
        Description copied from interface: SourceVisitor
        Visits an array allocation.
        Specified by:
        visitNewArray in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitArrayInit

        public T visitArrayInit​(ArrayInitExpr expr)
        Description copied from interface: SourceVisitor
        Visits a braced array initializer.
        Specified by:
        visitArrayInit in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitBinary

        public T visitBinary​(BinaryExpr expr)
        Description copied from interface: SourceVisitor
        Visits a binary operation.
        Specified by:
        visitBinary in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitUnary

        public T visitUnary​(UnaryExpr expr)
        Description copied from interface: SourceVisitor
        Visits a unary operation.
        Specified by:
        visitUnary in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitCast

        public T visitCast​(CastExpr expr)
        Description copied from interface: SourceVisitor
        Visits a cast.
        Specified by:
        visitCast in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitTernary

        public T visitTernary​(TernaryExpr expr)
        Description copied from interface: SourceVisitor
        Visits a ternary conditional.
        Specified by:
        visitTernary in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitLambda

        public T visitLambda​(LambdaExpr expr)
        Description copied from interface: SourceVisitor
        Visits a lambda expression.
        Specified by:
        visitLambda in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitThis

        public T visitThis​(ThisExpr expr)
        Description copied from interface: SourceVisitor
        Visits a this reference.
        Specified by:
        visitThis in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitSuper

        public T visitSuper​(SuperExpr expr)
        Description copied from interface: SourceVisitor
        Visits a super reference.
        Specified by:
        visitSuper in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result
      • visitClass

        public T visitClass​(ClassExpr expr)
        Description copied from interface: SourceVisitor
        Visits a class literal.
        Specified by:
        visitClass in interface SourceVisitor<T>
        Parameters:
        expr - the expression node
        Returns:
        the visitor's result