Module jdk.scripting.nashorn
Package jdk.nashorn.api.tree

## Class SimpleTreeVisitorES5_1<R,​P>

- java.lang.Object
- - jdk.nashorn.api.tree.SimpleTreeVisitorES5_1<R,​P>

- Type Parameters:
    `R` - the return type of this visitor's methods. Use `Void` for visitors that do not need to return results.
    `P` - the type of the additional parameter to this visitor's methods. Use `Void` for visitors that do not need an additional parameter.
  All Implemented Interfaces:
    `TreeVisitor<R,​P>`
  Direct Known Subclasses:
    `SimpleTreeVisitorES6`

      @Deprecated(since="11",
                  forRemoval=true)
      public class SimpleTreeVisitorES5_1<R,​P>
      extends Object
      implements TreeVisitor<R,​P>

  Deprecated, for removal: This API element is subject to removal in a future version.
  Nashorn JavaScript script engine and APIs, and the jjs tool are deprecated with the intent to remove them in a future release.
  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
    Constructor | Description
    --- | ---
    `SimpleTreeVisitorES5_1()` | Deprecated, for removal: This API element is subject to removal in a future version.

  - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `R` | `visitClassDeclaration​(ClassDeclarationTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits a `ClassDeclarationTree` tree by calling `visitUnknown`.
    `R` | `visitClassExpression​(ClassExpressionTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits a `ClassExpressionTree` tree by calling `visitUnknown`.
    `R` | `visitExportEntry​(ExportEntryTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits an `ExportEntryTree` tree by calling `visitUnknown`.
    `R` | `visitForOfLoop​(ForOfLoopTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits a `ForOfLoopTree` tree by calling `visitUnknown`.
    `R` | `visitImportEntry​(ImportEntryTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits an `ImportEntryTree` tree by calling `visitUnknown`.
    `R` | `visitModule​(ModuleTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits a `ModuleTree` tree by calling `visitUnknown`.
    `R` | `visitSpread​(SpreadTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits a `SpreadTree` tree by calling `visitUnknown`.
    `R` | `visitTemplateLiteral​(TemplateLiteralTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits a `TemplateLiteralTree` tree by calling `visitUnknown`.
    `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` | `visitYield​(YieldTree node, P p)` | Deprecated, for removal: This API element is subject to removal in a future version. Visits a `YieldTree` tree by calling `visitUnknown`.

    - ### 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`

- - ### Constructor Detail

    - #### SimpleTreeVisitorES5_1

          public SimpleTreeVisitorES5_1()

      Deprecated, for removal: This API element is subject to removal in a future version.

  - ### Method Detail

    - #### visitModule

          public R visitModule​(ModuleTree node,
                               P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits a `ModuleTree` tree by calling `visitUnknown`.
      Specified by:
        `visitModule` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitExportEntry

          public R visitExportEntry​(ExportEntryTree node,
                                    P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits an `ExportEntryTree` tree by calling `visitUnknown`.
      Specified by:
        `visitExportEntry` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitImportEntry

          public R visitImportEntry​(ImportEntryTree node,
                                    P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits an `ImportEntryTree` tree by calling `visitUnknown`.
      Specified by:
        `visitImportEntry` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitClassDeclaration

          public R visitClassDeclaration​(ClassDeclarationTree node,
                                         P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits a `ClassDeclarationTree` tree by calling `visitUnknown`.
      Specified by:
        `visitClassDeclaration` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitClassExpression

          public R visitClassExpression​(ClassExpressionTree node,
                                        P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits a `ClassExpressionTree` tree by calling `visitUnknown`.
      Specified by:
        `visitClassExpression` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitForOfLoop

          public R visitForOfLoop​(ForOfLoopTree node,
                                  P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits a `ForOfLoopTree` tree by calling `visitUnknown`.
      Specified by:
        `visitForOfLoop` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitTemplateLiteral

          public R visitTemplateLiteral​(TemplateLiteralTree node,
                                        P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits a `TemplateLiteralTree` tree by calling `visitUnknown`.
      Specified by:
        `visitTemplateLiteral` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitSpread

          public R visitSpread​(SpreadTree node,
                               P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits a `SpreadTree` tree by calling `visitUnknown`.
      Specified by:
        `visitSpread` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitYield

          public R visitYield​(YieldTree node,
                              P p)

      Deprecated, for removal: This API element is subject to removal in a future version.
      Visits a `YieldTree` tree by calling `visitUnknown`.
      Specified by:
        `visitYield` in interface `TreeVisitor<R,​P>`
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        the result of `visitUnknown`

    - #### visitUnknown

          public 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. 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:
        `visitUnknown` in interface `TreeVisitor<R,​P>`
      Implementation Requirements:
        The default implementation of this method in `SimpleTreeVisitorES5_1` will always throw `UnknownTypeException`. This behavior is not required of a subclass.
      Parameters:
        `node` - node being visited
        `p` - extra parameter passed to the visitor
      Returns:
        abnormal return by throwing exception always
      Throws:
        `UnknownTreeException` - a visitor implementation may optionally throw this exception