-
- Type Parameters:
R
- the return type of this visitor's methods. UseVoid
for visitors that do not need to return results.P
- the type of the additional parameter to this visitor's methods. UseVoid
for visitors that do not need an additional parameter.
- All Known Implementing Classes:
SimpleTreeVisitorES5_1
,SimpleTreeVisitorES6
public interface TreeVisitor<R,P>
A visitor of trees, in the style of the visitor design pattern. Classes implementing this interface are used to operate on a tree when the kind of tree is unknown at compile time. When a visitor is passed to an tree'saccept
method, thevisitXyz
method most applicable to that tree is invoked.Classes implementing this interface may or may not throw a
NullPointerException
if the additional parameterp
isnull
; see documentation of the implementing class for details.WARNING: It is possible that methods will be added to this interface to accommodate new, currently unknown, language structures added to future versions of the ECMAScript programming language. When new visit methods are added for new Tree subtypes, default method bodies will be introduced which will call visitUnknown method as a fallback.
- Since:
- 9
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description R
visitArrayAccess(ArrayAccessTree node, P p)
Visit array access expression tree.R
visitArrayLiteral(ArrayLiteralTree node, P p)
Visit array literal expression tree.R
visitAssignment(AssignmentTree node, P p)
Visit assignment tree.R
visitBinary(BinaryTree node, P p)
Visit binary expression tree.R
visitBlock(BlockTree node, P p)
Visit block statement tree.R
visitBreak(BreakTree node, P p)
Visit break statement tree.R
visitCase(CaseTree node, P p)
Visit case statement tree.R
visitCatch(CatchTree node, P p)
Visit catch block statement tree.R
visitClassDeclaration(ClassDeclarationTree node, P p)
Visit class statement tree.R
visitClassExpression(ClassExpressionTree node, P p)
Visit class expression tree.R
visitCompilationUnit(CompilationUnitTree node, P p)
Visit compilation unit tree.R
visitCompoundAssignment(CompoundAssignmentTree node, P p)
Visit compound assignment tree.R
visitConditionalExpression(ConditionalExpressionTree node, P p)
Visit conditional expression tree.R
visitContinue(ContinueTree node, P p)
Visit continue statement tree.R
visitDebugger(DebuggerTree node, P p)
Visit debugger statement tree.R
visitDoWhileLoop(DoWhileLoopTree node, P p)
Visit do-while statement tree.R
visitEmptyStatement(EmptyStatementTree node, P p)
Visit an empty statement tree.R
visitErroneous(ErroneousTree node, P p)
Visit error expression tree.R
visitExportEntry(ExportEntryTree node, P p)
Visit Module ExportEntry tree.R
visitExpressionStatement(ExpressionStatementTree node, P p)
Visit expression statement tree.R
visitForInLoop(ForInLoopTree node, P p)
Visit for..in statement tree.R
visitForLoop(ForLoopTree node, P p)
Visit 'for' statement tree.R
visitForOfLoop(ForOfLoopTree node, P p)
Visit for..of statement tree.R
visitFunctionCall(FunctionCallTree node, P p)
Visit function call expression tree.R
visitFunctionDeclaration(FunctionDeclarationTree node, P p)
Visit function declaration tree.R
visitFunctionExpression(FunctionExpressionTree node, P p)
Visit function expression tree.R
visitIdentifier(IdentifierTree node, P p)
Visit identifier tree.R
visitIf(IfTree node, P p)
Visit 'if' statement tree.R
visitImportEntry(ImportEntryTree node, P p)
Visit Module ImportEntry tree.R
visitInstanceOf(InstanceOfTree node, P p)
Visit 'instanceof' expression tree.R
visitLabeledStatement(LabeledStatementTree node, P p)
Visit labeled statement tree.R
visitLiteral(LiteralTree node, P p)
Visit literal expression tree.R
visitMemberSelect(MemberSelectTree node, P p)
Visit member select expression tree.R
visitModule(ModuleTree node, P p)
Visit Module tree.R
visitNew(NewTree node, P p)
Visit 'new' expression tree.R
visitObjectLiteral(ObjectLiteralTree node, P p)
Visit object literal tree.R
visitParenthesized(ParenthesizedTree node, P p)
Visit parenthesized expression tree.R
visitProperty(PropertyTree node, P p)
Visit a property of an object literal expression tree.R
visitRegExpLiteral(RegExpLiteralTree node, P p)
Visit regular expression literal tree.R
visitReturn(ReturnTree node, P p)
Visit return statement tree.R
visitSpread(SpreadTree node, P p)
Visit 'spread' expression tree.R
visitSwitch(SwitchTree node, P p)
Visit 'switch' statement tree.R
visitTemplateLiteral(TemplateLiteralTree node, P p)
Visit template literal tree.R
visitThrow(ThrowTree node, P p)
Visit 'throw' expression tree.R
visitTry(TryTree node, P p)
Visit 'try' statement tree.R
visitUnary(UnaryTree node, P p)
Visit unary expression tree.R
visitUnknown(Tree node, P p)
Visit unknown expression/statement tree.R
visitVariable(VariableTree node, P p)
Visit variable declaration tree.R
visitWhileLoop(WhileLoopTree node, P p)
Visit 'while' statement tree.R
visitWith(WithTree node, P p)
Visit 'with' statement tree.R
visitYield(YieldTree node, P p)
Visit 'yield' expression tree.
-
-
-
Method Detail
-
visitAssignment
R visitAssignment(AssignmentTree node, P p)
Visit assignment tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCompoundAssignment
R visitCompoundAssignment(CompoundAssignmentTree node, P p)
Visit compound assignment tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitBinary
R visitBinary(BinaryTree node, P p)
Visit binary expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitBlock
R visitBlock(BlockTree node, P p)
Visit block statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitBreak
R visitBreak(BreakTree node, P p)
Visit break statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCase
R visitCase(CaseTree node, P p)
Visit case statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCatch
R visitCatch(CatchTree node, P p)
Visit catch block statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitClassDeclaration
R visitClassDeclaration(ClassDeclarationTree node, P p)
Visit class statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitClassExpression
R visitClassExpression(ClassExpressionTree node, P p)
Visit class expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitConditionalExpression
R visitConditionalExpression(ConditionalExpressionTree node, P p)
Visit conditional expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitContinue
R visitContinue(ContinueTree node, P p)
Visit continue statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitDebugger
R visitDebugger(DebuggerTree node, P p)
Visit debugger statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitDoWhileLoop
R visitDoWhileLoop(DoWhileLoopTree node, P p)
Visit do-while statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitErroneous
R visitErroneous(ErroneousTree node, P p)
Visit error expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitExpressionStatement
R visitExpressionStatement(ExpressionStatementTree node, P p)
Visit expression statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitForLoop
R visitForLoop(ForLoopTree node, P p)
Visit 'for' statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitForInLoop
R visitForInLoop(ForInLoopTree node, P p)
Visit for..in statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitForOfLoop
R visitForOfLoop(ForOfLoopTree node, P p)
Visit for..of statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitFunctionCall
R visitFunctionCall(FunctionCallTree node, P p)
Visit function call expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitFunctionDeclaration
R visitFunctionDeclaration(FunctionDeclarationTree node, P p)
Visit function declaration tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitFunctionExpression
R visitFunctionExpression(FunctionExpressionTree node, P p)
Visit function expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitIdentifier
R visitIdentifier(IdentifierTree node, P p)
Visit identifier tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitIf
R visitIf(IfTree node, P p)
Visit 'if' statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitArrayAccess
R visitArrayAccess(ArrayAccessTree node, P p)
Visit array access expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitArrayLiteral
R visitArrayLiteral(ArrayLiteralTree node, P p)
Visit array literal expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitLabeledStatement
R visitLabeledStatement(LabeledStatementTree node, P p)
Visit labeled statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitLiteral
R visitLiteral(LiteralTree node, P p)
Visit literal expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitParenthesized
R visitParenthesized(ParenthesizedTree node, P p)
Visit parenthesized expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitReturn
R visitReturn(ReturnTree node, P p)
Visit return statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitMemberSelect
R visitMemberSelect(MemberSelectTree node, P p)
Visit member select expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitNew
R visitNew(NewTree node, P p)
Visit 'new' expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitObjectLiteral
R visitObjectLiteral(ObjectLiteralTree node, P p)
Visit object literal tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitProperty
R visitProperty(PropertyTree node, P p)
Visit a property of an object literal expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitRegExpLiteral
R visitRegExpLiteral(RegExpLiteralTree node, P p)
Visit regular expression literal tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitTemplateLiteral
R visitTemplateLiteral(TemplateLiteralTree node, P p)
Visit template literal tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitEmptyStatement
R visitEmptyStatement(EmptyStatementTree node, P p)
Visit an empty statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitSpread
R visitSpread(SpreadTree node, P p)
Visit 'spread' expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitSwitch
R visitSwitch(SwitchTree node, P p)
Visit 'switch' statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitThrow
R visitThrow(ThrowTree node, P p)
Visit 'throw' expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCompilationUnit
R visitCompilationUnit(CompilationUnitTree node, P p)
Visit compilation unit tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitModule
R visitModule(ModuleTree node, P p)
Visit Module tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitExportEntry
R visitExportEntry(ExportEntryTree node, P p)
Visit Module ExportEntry tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitImportEntry
R visitImportEntry(ImportEntryTree node, P p)
Visit Module ImportEntry tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitTry
R visitTry(TryTree node, P p)
Visit 'try' statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitInstanceOf
R visitInstanceOf(InstanceOfTree node, P p)
Visit 'instanceof' expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitUnary
R visitUnary(UnaryTree node, P p)
Visit unary expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitVariable
R visitVariable(VariableTree node, P p)
Visit variable declaration tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitWhileLoop
R visitWhileLoop(WhileLoopTree node, P p)
Visit 'while' statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitWith
R visitWith(WithTree node, P p)
Visit 'with' statement tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitYield
R visitYield(YieldTree node, P p)
Visit 'yield' expression tree.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitUnknown
R visitUnknown(Tree node, P p)
Visit unknown expression/statement tree. This fallback will be called if new Tree subtypes are introduced in future. A specific implementation may throw {unknown tree exception if the visitor implementation was for an older language version.- Parameters:
node
- node being visitedp
- extra parameter passed to the visitor- Returns:
- value from the visitor
-
-