< prev index next >

nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/TreeVisitor.java

Print this page




  34  * to that tree is invoked.
  35  *
  36  * <p> Classes implementing this interface may or may not throw a
  37  * {@code NullPointerException} if the additional parameter {@code p}
  38  * is {@code null}; see documentation of the implementing class for
  39  * details.
  40  *
  41  * <p> <b>WARNING:</b> It is possible that methods will be added to
  42  this interface to accommodate new, currently unknown, language
  43  structures added to future versions of the ECMAScript programming
  44  language. When new visit methods are added for new Tree subtypes,
  45  default method bodies will be introduced which will call visitUnknown
  46  method as a fallback.
  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  * @since 1.9
  55  */
  56 public interface TreeVisitor<R,P> {
  57     /**
  58      * Visit assignment tree.
  59      *
  60      * @param node node being visited
  61      * @param p extra parameter passed to the visitor
  62      * @return value from the visitor
  63      */
  64     R visitAssignment(AssignmentTree node, P p);
  65 
  66     /**
  67      * Visit compound assignment tree.
  68      *
  69      * @param node node being visited
  70      * @param p extra parameter passed to the visitor
  71      * @return value from the visitor
  72      */
  73     R visitCompoundAssignment(CompoundAssignmentTree node, P p);
  74 




  34  * to that tree is invoked.
  35  *
  36  * <p> Classes implementing this interface may or may not throw a
  37  * {@code NullPointerException} if the additional parameter {@code p}
  38  * is {@code null}; see documentation of the implementing class for
  39  * details.
  40  *
  41  * <p> <b>WARNING:</b> It is possible that methods will be added to
  42  this interface to accommodate new, currently unknown, language
  43  structures added to future versions of the ECMAScript programming
  44  language. When new visit methods are added for new Tree subtypes,
  45  default method bodies will be introduced which will call visitUnknown
  46  method as a fallback.
  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  * @since 9
  55  */
  56 public interface TreeVisitor<R,P> {
  57     /**
  58      * Visit assignment tree.
  59      *
  60      * @param node node being visited
  61      * @param p extra parameter passed to the visitor
  62      * @return value from the visitor
  63      */
  64     R visitAssignment(AssignmentTree node, P p);
  65 
  66     /**
  67      * Visit compound assignment tree.
  68      *
  69      * @param node node being visited
  70      * @param p extra parameter passed to the visitor
  71      * @return value from the visitor
  72      */
  73     R visitCompoundAssignment(CompoundAssignmentTree node, P p);
  74 


< prev index next >