Interface TreeVisitor<R,P>
- 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
@Deprecated(since="11", forRemoval=true) 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's accept
method, the visitXyz
method most applicable to that tree is invoked.
Classes implementing this interface may or may not throw a NullPointerException
if the additional parameter p
is null
; 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
Methods
Modifier and Type | Method | Description |
---|---|---|
R | visitArrayAccess(ArrayAccessTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit array access expression tree. |
R | visitArrayLiteral(ArrayLiteralTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit array literal expression tree. |
R | visitAssignment(AssignmentTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit assignment tree. |
R | visitBinary(BinaryTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit binary expression tree. |
R | visitBlock(BlockTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit block statement tree. |
R | visitBreak(BreakTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit break statement tree. |
R | visitCase(CaseTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit case statement tree. |
R | visitCatch(CatchTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit catch block statement tree. |
R | visitClassDeclaration(ClassDeclarationTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit class statement tree. |
R | visitClassExpression(ClassExpressionTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit class expression tree. |
R | visitCompilationUnit(CompilationUnitTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit compilation unit tree. |
R | visitCompoundAssignment(CompoundAssignmentTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit compound assignment tree. |
R | visitConditionalExpression(ConditionalExpressionTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit conditional expression tree. |
R | visitContinue(ContinueTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit continue statement tree. |
R | visitDebugger(DebuggerTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit debugger statement tree. |
R | visitDoWhileLoop(DoWhileLoopTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit do-while statement tree. |
R | visitEmptyStatement(EmptyStatementTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit an empty statement tree. |
R | visitErroneous(ErroneousTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit error expression tree. |
R | visitExportEntry(ExportEntryTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit Module ExportEntry tree. |
R | visitExpressionStatement(ExpressionStatementTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit expression statement tree. |
R | visitForInLoop(ForInLoopTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit for..in statement tree. |
R | visitForLoop(ForLoopTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'for' statement tree. |
R | visitForOfLoop(ForOfLoopTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit for..of statement tree. |
R | visitFunctionCall(FunctionCallTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit function call expression tree. |
R | visitFunctionDeclaration(FunctionDeclarationTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit function declaration tree. |
R | visitFunctionExpression(FunctionExpressionTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit function expression tree. |
R | visitIdentifier(IdentifierTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit identifier tree. |
R | visitIf(IfTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'if' statement tree. |
R | visitImportEntry(ImportEntryTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit Module ImportEntry tree. |
R | visitInstanceOf(InstanceOfTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'instanceof' expression tree. |
R | visitLabeledStatement(LabeledStatementTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit labeled statement tree. |
R | visitLiteral(LiteralTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit literal expression tree. |
R | visitMemberSelect(MemberSelectTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit member select expression tree. |
R | visitModule(ModuleTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit Module tree. |
R | visitNew(NewTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'new' expression tree. |
R | visitObjectLiteral(ObjectLiteralTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit object literal tree. |
R | visitParenthesized(ParenthesizedTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit parenthesized expression tree. |
R | visitProperty(PropertyTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit a property of an object literal expression tree. |
R | visitRegExpLiteral(RegExpLiteralTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit regular expression literal tree. |
R | visitReturn(ReturnTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit return statement tree. |
R | visitSpread(SpreadTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'spread' expression tree. |
R | visitSwitch(SwitchTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'switch' statement tree. |
R | visitTemplateLiteral(TemplateLiteralTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit template literal tree. |
R | visitThrow(ThrowTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'throw' expression tree. |
R | visitTry(TryTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'try' statement tree. |
R | visitUnary(UnaryTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit unary expression tree. |
R | visitUnknown(Tree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit unknown expression/statement tree. |
R | visitVariable(VariableTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit variable declaration tree. |
R | visitWhileLoop(WhileLoopTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'while' statement tree. |
R | visitWith(WithTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'with' statement tree. |
R | visitYield(YieldTree node,
P p) | Deprecated, for removal: This API element is subject to removal in a future version. Visit 'yield' expression tree. |
Methods
visitAssignment
R visitAssignment(AssignmentTree node, P p)
Visit assignment tree.
- Parameters:
-
node
- node being visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- 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 visited -
p
- extra parameter passed to the visitor - Returns:
- value from the visitor
© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/11/docs/api/jdk.scripting.nashorn/jdk/nashorn/api/tree/TreeVisitor.html