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