Class SimpleTreeVisitorES5_1<R,P>
java.lang.Object
org.openjdk.nashorn.api.tree.SimpleTreeVisitorES5_1<R,P>
- Type Parameters:
R- the return type of this visitor's methods. UseVoidfor visitors that do not need to return results.P- the type of the additional parameter to this visitor's methods. UseVoidfor visitors that do not need an additional parameter.
- All Implemented Interfaces:
TreeVisitor<R,P>
- Direct Known Subclasses:
SimpleTreeVisitorES6
A simple implementation of the TreeVisitor for ECMAScript edition 5.1.
The visit methods corresponding to ES 5.1 language constructs walk the "components" of the given tree by calling accept method passing the current visitor and the additional parameter.
For constructs introduced in later versions, visitUnknown
is called instead which throws UnknownTreeException.
Methods in this class may be overridden subject to their
general contract. Note that annotating methods in concrete
subclasses with @Override will help
ensure that methods are overridden as intended.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvisitArrayAccess(ArrayAccessTree node, P r) Visit array access expression tree.visitArrayLiteral(ArrayLiteralTree node, P r) Visit array literal expression tree.visitAssignment(AssignmentTree node, P r) Visit assignment tree.visitBinary(BinaryTree node, P r) Visit binary expression tree.visitBlock(BlockTree node, P r) Visit block statement tree.visitBreak(BreakTree node, P r) Visit break statement tree.Visit case statement tree.visitCatch(CatchTree node, P r) Visit catch block statement tree.visitClassDeclaration(ClassDeclarationTree node, P p) Visits aClassDeclarationTreetree by callingvisitUnknown.visitClassExpression(ClassExpressionTree node, P p) Visits aClassExpressionTreetree by callingvisitUnknown.visitCompilationUnit(CompilationUnitTree node, P r) Visit compilation unit tree.Visit compound assignment tree.Visit conditional expression tree.visitContinue(ContinueTree node, P r) Visit continue statement tree.visitDebugger(DebuggerTree node, P r) Visit debugger statement tree.visitDoWhileLoop(DoWhileLoopTree node, P r) Visit do-while statement tree.visitEmptyStatement(EmptyStatementTree node, P r) Visit an empty statement tree.visitErroneous(ErroneousTree node, P r) Visit error expression tree.visitExportEntry(ExportEntryTree node, P p) Visits anExportEntryTreetree by callingvisitUnknown.Visit expression statement tree.visitForInLoop(ForInLoopTree node, P r) Visit for..in statement tree.visitForLoop(ForLoopTree node, P r) Visit 'for' statement tree.visitForOfLoop(ForOfLoopTree node, P p) Visits aForOfLoopTreetree by callingvisitUnknown.visitFunctionCall(FunctionCallTree node, P r) Visit function call expression tree.Visit function declaration tree.Visit function expression tree.visitIdentifier(IdentifierTree node, P r) Visit identifier tree.Visit 'if' statement tree.visitImportEntry(ImportEntryTree node, P p) Visits anImportEntryTreetree by callingvisitUnknown.visitInstanceOf(InstanceOfTree node, P r) Visit 'instanceof' expression tree.visitLabeledStatement(LabeledStatementTree node, P r) Visit labeled statement tree.visitLiteral(LiteralTree node, P r) Visit literal expression tree.visitMemberSelect(MemberSelectTree node, P r) Visit member select expression tree.visitModule(ModuleTree node, P p) Visits aModuleTreetree by callingvisitUnknown.Visit 'new' expression tree.visitObjectLiteral(ObjectLiteralTree node, P r) Visit object literal tree.visitParenthesized(ParenthesizedTree node, P r) Visit parenthesized expression tree.visitProperty(PropertyTree node, P r) Visit a property of an object literal expression tree.visitRegExpLiteral(RegExpLiteralTree node, P r) Visit regular expression literal tree.visitReturn(ReturnTree node, P r) Visit return statement tree.visitSpread(SpreadTree node, P p) Visits aSpreadTreetree by callingvisitUnknown.visitSwitch(SwitchTree node, P r) Visit 'switch' statement tree.visitTemplateLiteral(TemplateLiteralTree node, P p) Visits aTemplateLiteralTreetree by callingvisitUnknown.visitThrow(ThrowTree node, P r) Visit 'throw' expression tree.Visit 'try' statement tree.visitUnary(UnaryTree node, P r) Visit unary expression tree.visitUnknown(Tree node, P p) Visit unknown expression/statement tree.visitVariable(VariableTree node, P r) Visit variable declaration tree.visitWhileLoop(WhileLoopTree node, P r) Visit 'while' statement tree.Visit 'with' statement tree.visitYield(YieldTree node, P p) Visits aYieldTreetree by callingvisitUnknown.
-
Constructor Details
-
SimpleTreeVisitorES5_1
public SimpleTreeVisitorES5_1()
-
-
Method Details
-
visitAssignment
Description copied from interface:TreeVisitorVisit assignment tree.- Specified by:
visitAssignmentin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCompoundAssignment
Description copied from interface:TreeVisitorVisit compound assignment tree.- Specified by:
visitCompoundAssignmentin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitModule
Visits aModuleTreetree by callingvisitUnknown.- Specified by:
visitModulein interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitExportEntry
Visits anExportEntryTreetree by callingvisitUnknown.- Specified by:
visitExportEntryin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitImportEntry
Visits anImportEntryTreetree by callingvisitUnknown.- Specified by:
visitImportEntryin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitBinary
Description copied from interface:TreeVisitorVisit binary expression tree.- Specified by:
visitBinaryin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitBlock
Description copied from interface:TreeVisitorVisit block statement tree.- Specified by:
visitBlockin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitBreak
Description copied from interface:TreeVisitorVisit break statement tree.- Specified by:
visitBreakin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCase
Description copied from interface:TreeVisitorVisit case statement tree.- Specified by:
visitCasein interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCatch
Description copied from interface:TreeVisitorVisit catch block statement tree.- Specified by:
visitCatchin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitClassDeclaration
Visits aClassDeclarationTreetree by callingvisitUnknown.- Specified by:
visitClassDeclarationin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitClassExpression
Visits aClassExpressionTreetree by callingvisitUnknown.- Specified by:
visitClassExpressionin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitConditionalExpression
Description copied from interface:TreeVisitorVisit conditional expression tree.- Specified by:
visitConditionalExpressionin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitContinue
Description copied from interface:TreeVisitorVisit continue statement tree.- Specified by:
visitContinuein interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitDebugger
Description copied from interface:TreeVisitorVisit debugger statement tree.- Specified by:
visitDebuggerin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitDoWhileLoop
Description copied from interface:TreeVisitorVisit do-while statement tree.- Specified by:
visitDoWhileLoopin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitErroneous
Description copied from interface:TreeVisitorVisit error expression tree.- Specified by:
visitErroneousin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitExpressionStatement
Description copied from interface:TreeVisitorVisit expression statement tree.- Specified by:
visitExpressionStatementin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitForLoop
Description copied from interface:TreeVisitorVisit 'for' statement tree.- Specified by:
visitForLoopin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitForInLoop
Description copied from interface:TreeVisitorVisit for..in statement tree.- Specified by:
visitForInLoopin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitForOfLoop
Visits aForOfLoopTreetree by callingvisitUnknown.- Specified by:
visitForOfLoopin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitFunctionCall
Description copied from interface:TreeVisitorVisit function call expression tree.- Specified by:
visitFunctionCallin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitFunctionDeclaration
Description copied from interface:TreeVisitorVisit function declaration tree.- Specified by:
visitFunctionDeclarationin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitFunctionExpression
Description copied from interface:TreeVisitorVisit function expression tree.- Specified by:
visitFunctionExpressionin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitIdentifier
Description copied from interface:TreeVisitorVisit identifier tree.- Specified by:
visitIdentifierin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitIf
Description copied from interface:TreeVisitorVisit 'if' statement tree.- Specified by:
visitIfin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitArrayAccess
Description copied from interface:TreeVisitorVisit array access expression tree.- Specified by:
visitArrayAccessin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitArrayLiteral
Description copied from interface:TreeVisitorVisit array literal expression tree.- Specified by:
visitArrayLiteralin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitLabeledStatement
Description copied from interface:TreeVisitorVisit labeled statement tree.- Specified by:
visitLabeledStatementin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitLiteral
Description copied from interface:TreeVisitorVisit literal expression tree.- Specified by:
visitLiteralin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitParenthesized
Description copied from interface:TreeVisitorVisit parenthesized expression tree.- Specified by:
visitParenthesizedin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitReturn
Description copied from interface:TreeVisitorVisit return statement tree.- Specified by:
visitReturnin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitMemberSelect
Description copied from interface:TreeVisitorVisit member select expression tree.- Specified by:
visitMemberSelectin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitNew
Description copied from interface:TreeVisitorVisit 'new' expression tree.- Specified by:
visitNewin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitObjectLiteral
Description copied from interface:TreeVisitorVisit object literal tree.- Specified by:
visitObjectLiteralin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitProperty
Description copied from interface:TreeVisitorVisit a property of an object literal expression tree.- Specified by:
visitPropertyin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitRegExpLiteral
Description copied from interface:TreeVisitorVisit regular expression literal tree.- Specified by:
visitRegExpLiteralin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitTemplateLiteral
Visits aTemplateLiteralTreetree by callingvisitUnknown.- Specified by:
visitTemplateLiteralin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitEmptyStatement
Description copied from interface:TreeVisitorVisit an empty statement tree.- Specified by:
visitEmptyStatementin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitSpread
Visits aSpreadTreetree by callingvisitUnknown.- Specified by:
visitSpreadin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitSwitch
Description copied from interface:TreeVisitorVisit 'switch' statement tree.- Specified by:
visitSwitchin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitThrow
Description copied from interface:TreeVisitorVisit 'throw' expression tree.- Specified by:
visitThrowin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitCompilationUnit
Description copied from interface:TreeVisitorVisit compilation unit tree.- Specified by:
visitCompilationUnitin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitTry
Description copied from interface:TreeVisitorVisit 'try' statement tree.- Specified by:
visitTryin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitInstanceOf
Description copied from interface:TreeVisitorVisit 'instanceof' expression tree.- Specified by:
visitInstanceOfin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitUnary
Description copied from interface:TreeVisitorVisit unary expression tree.- Specified by:
visitUnaryin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitVariable
Description copied from interface:TreeVisitorVisit variable declaration tree.- Specified by:
visitVariablein interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitWhileLoop
Description copied from interface:TreeVisitorVisit 'while' statement tree.- Specified by:
visitWhileLoopin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitWith
Description copied from interface:TreeVisitorVisit 'with' statement tree.- Specified by:
visitWithin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedr- extra parameter passed to the visitor- Returns:
- value from the visitor
-
visitYield
Visits aYieldTreetree by callingvisitUnknown.- Specified by:
visitYieldin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- the result of
visitUnknown
-
visitUnknown
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.- Specified by:
visitUnknownin interfaceTreeVisitor<R,P> - Parameters:
node- node being visitedp- extra parameter passed to the visitor- Returns:
- abnormal return by throwing exception always
- Throws:
UnknownTreeException- a visitor implementation may optionally throw this exception- Implementation Requirements:
- The default implementation of this method in
SimpleTreeVisitorES5_1will always throwUnknownTypeException. This behavior is not required of a subclass.
-