- java.lang.Object
-
- jdk.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
public class SimpleTreeVisitorES5_1<R,P> extends Object implements TreeVisitor<R,P>
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,
visitUnknownis called instead which throwsUnknownTreeException.Methods in this class may be overridden subject to their general contract. Note that annotating methods in concrete subclasses with
@Overridewill help ensure that methods are overridden as intended.
-
-
Constructor Summary
Constructors Constructor Description SimpleTreeVisitorES5_1()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RvisitClassDeclaration(ClassDeclarationTree node, P p)Visits aClassDeclarationTreetree by callingvisitUnknown.RvisitClassExpression(ClassExpressionTree node, P p)Visits aClassExpressionTreetree by callingvisitUnknown.RvisitExportEntry(ExportEntryTree node, P p)Visits anExportEntryTreetree by callingvisitUnknown.RvisitForOfLoop(ForOfLoopTree node, P p)Visits aForOfLoopTreetree by callingvisitUnknown.RvisitImportEntry(ImportEntryTree node, P p)Visits anImportEntryTreetree by callingvisitUnknown.RvisitModule(ModuleTree node, P p)Visits aModuleTreetree by callingvisitUnknown.RvisitSpread(SpreadTree node, P p)Visits aSpreadTreetree by callingvisitUnknown.RvisitTemplateLiteral(TemplateLiteralTree node, P p)Visits aTemplateLiteralTreetree by callingvisitUnknown.RvisitUnknown(Tree node, P p)Visit unknown expression/statement tree.RvisitYield(YieldTree node, P p)Visits aYieldTreetree by callingvisitUnknown.-
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods declared in interface jdk.nashorn.api.tree.TreeVisitor
visitArrayAccess, visitArrayLiteral, visitAssignment, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDebugger, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForInLoop, visitForLoop, visitFunctionCall, visitFunctionDeclaration, visitFunctionExpression, visitIdentifier, visitIf, visitInstanceOf, visitLabeledStatement, visitLiteral, visitMemberSelect, visitNew, visitObjectLiteral, visitParenthesized, visitProperty, visitRegExpLiteral, visitReturn, visitSwitch, visitThrow, visitTry, visitUnary, visitVariable, visitWhileLoop, visitWith
-
-
-
-
Method Detail
-
visitModule
public R visitModule(ModuleTree node, P p)
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
public R visitExportEntry(ExportEntryTree node, P p)
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
public R visitImportEntry(ImportEntryTree node, P p)
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
-
visitClassDeclaration
public R visitClassDeclaration(ClassDeclarationTree node, P p)
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
public R visitClassExpression(ClassExpressionTree node, P p)
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
-
visitForOfLoop
public R visitForOfLoop(ForOfLoopTree node, P p)
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
-
visitTemplateLiteral
public R visitTemplateLiteral(TemplateLiteralTree node, P p)
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
-
visitSpread
public R visitSpread(SpreadTree node, P p)
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
-
visitYield
public R visitYield(YieldTree node, P p)
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
public 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.- Specified by:
visitUnknownin interfaceTreeVisitor<R,P>- Implementation Requirements:
- The default implementation of this method in
SimpleTreeVisitorES5_1will always throwUnknownTypeException. This behavior is not required of a subclass. - 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
-
-