< prev index next >

## src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/SimpleTreeVisitorES6.java

Print this page

      25
      26 package jdk.nashorn.api.tree;
      27
      28 import java.util.List;
      29
      30 /**
      31  * A simple implementation of the TreeVisitor for ECMAScript edition 6.
      32  *
      33  * <p>The visit methods corresponding to ES 6 language constructs walk the
      34  * "components" of the given tree by calling accept method passing the
      35  * current visitor and the additional parameter.
      36  *
      37  * <p>For constructs introduced in later versions, {@code visitUnknown}
      38  * is called instead which throws {@link UnknownTreeException}.
      39  *
      40  * <p> Methods in this class may be overridden subject to their
      41  * general contract.  Note that annotating methods in concrete
      42  * subclasses with {@link java.lang.Override @Override} will help
      43  * ensure that methods are overridden as intended.
      44  *

      45  * @param <R> the return type of this visitor's methods.  Use {@link
      46  *            Void} for visitors that do not need to return results.
      47  * @param <P> the type of the additional parameter to this visitor's
      48  *            methods.  Use {@code Void} for visitors that do not need an
      49  *            additional parameter.
      50  */

      51 public class SimpleTreeVisitorES6<R, P> extends SimpleTreeVisitorES5_1<R, P> {
      52     @Override
      53     public R visitCompilationUnit(final CompilationUnitTree node, final P r) {
      54         final ModuleTree mod = node.getModule();
      55         if (mod != null) {
      56             mod.accept(this, r);
      57         }
      58         return super.visitCompilationUnit(node, r);
      59     }
      60
      61     /**
      62      * Visit Module tree.
      63      *
      64      * @param node node being visited
      65      * @param p extra parameter passed to the visitor
      66      * @return value from the visitor
      67      */
      68     @Override
      69     public R visitModule(final ModuleTree node, final P p) {
      70         node.getImportEntries().forEach(e -> visitImportEntry(e, p));
      25
      26 package jdk.nashorn.api.tree;
      27
      28 import java.util.List;
      29
      30 /**
      31  * A simple implementation of the TreeVisitor for ECMAScript edition 6.
      32  *
      33  * <p>The visit methods corresponding to ES 6 language constructs walk the
      34  * "components" of the given tree by calling accept method passing the
      35  * current visitor and the additional parameter.
      36  *
      37  * <p>For constructs introduced in later versions, {@code visitUnknown}
      38  * is called instead which throws {@link UnknownTreeException}.
      39  *
      40  * <p> Methods in this class may be overridden subject to their
      41  * general contract.  Note that annotating methods in concrete
      42  * subclasses with {@link java.lang.Override @Override} will help
      43  * ensure that methods are overridden as intended.
      44  *
      45  * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
      46  * are deprecated with the intent to remove them in a future release.
      47  *
      48  * @param <R> the return type of this visitor's methods.  Use {@link
      49  *            Void} for visitors that do not need to return results.
      50  * @param <P> the type of the additional parameter to this visitor's
      51  *            methods.  Use {@code Void} for visitors that do not need an
      52  *            additional parameter.
      53  */
      54 @Deprecated(since="11", forRemoval=true)
      55 public class SimpleTreeVisitorES6<R, P> extends SimpleTreeVisitorES5_1<R, P> {
      56     @Override
      57     public R visitCompilationUnit(final CompilationUnitTree node, final P r) {
      58         final ModuleTree mod = node.getModule();
      59         if (mod != null) {
      60             mod.accept(this, r);
      61         }
      62         return super.visitCompilationUnit(node, r);
      63     }
      64
      65     /**
      66      * Visit Module tree.
      67      *
      68      * @param node node being visited
      69      * @param p extra parameter passed to the visitor
      70      * @return value from the visitor
      71      */
      72     @Override
      73     public R visitModule(final ModuleTree node, final P p) {
      74         node.getImportEntries().forEach(e -> visitImportEntry(e, p));

< prev index next >