28 import jdk.nashorn.internal.ir.BinaryNode;
29 import jdk.nashorn.internal.ir.LexicalContext;
30 import jdk.nashorn.internal.ir.Node;
31 import jdk.nashorn.internal.ir.UnaryNode;
32
33 /**
34 * Like NodeVisitor but navigating further into operators.
35 * @param <T> Lexical context class for this NodeOperatorVisitor
36 */
37 public abstract class NodeOperatorVisitor<T extends LexicalContext> extends NodeVisitor<T> {
38 /**
39 * Constructor
40 *
41 * @param lc a custom lexical context
42 */
43 public NodeOperatorVisitor(final T lc) {
44 super(lc);
45 }
46
47 @Override
48 public final boolean enterUnaryNode(final UnaryNode unaryNode) {
49 switch (unaryNode.tokenType()) {
50 case ADD:
51 return enterADD(unaryNode);
52 case BIT_NOT:
53 return enterBIT_NOT(unaryNode);
54 case DELETE:
55 return enterDELETE(unaryNode);
56 case NEW:
57 return enterNEW(unaryNode);
58 case NOT:
59 return enterNOT(unaryNode);
60 case SUB:
61 return enterSUB(unaryNode);
62 case TYPEOF:
63 return enterTYPEOF(unaryNode);
64 case VOID:
65 return enterVOID(unaryNode);
66 case DECPREFIX:
67 case DECPOSTFIX:
68 case INCPREFIX:
|
28 import jdk.nashorn.internal.ir.BinaryNode;
29 import jdk.nashorn.internal.ir.LexicalContext;
30 import jdk.nashorn.internal.ir.Node;
31 import jdk.nashorn.internal.ir.UnaryNode;
32
33 /**
34 * Like NodeVisitor but navigating further into operators.
35 * @param <T> Lexical context class for this NodeOperatorVisitor
36 */
37 public abstract class NodeOperatorVisitor<T extends LexicalContext> extends NodeVisitor<T> {
38 /**
39 * Constructor
40 *
41 * @param lc a custom lexical context
42 */
43 public NodeOperatorVisitor(final T lc) {
44 super(lc);
45 }
46
47 @Override
48 public boolean enterUnaryNode(final UnaryNode unaryNode) {
49 switch (unaryNode.tokenType()) {
50 case ADD:
51 return enterADD(unaryNode);
52 case BIT_NOT:
53 return enterBIT_NOT(unaryNode);
54 case DELETE:
55 return enterDELETE(unaryNode);
56 case NEW:
57 return enterNEW(unaryNode);
58 case NOT:
59 return enterNOT(unaryNode);
60 case SUB:
61 return enterSUB(unaryNode);
62 case TYPEOF:
63 return enterTYPEOF(unaryNode);
64 case VOID:
65 return enterVOID(unaryNode);
66 case DECPREFIX:
67 case DECPOSTFIX:
68 case INCPREFIX:
|