langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java
author pgovereau
Tue, 22 Apr 2014 17:07:54 -0400
changeset 24069 dfb8f11542fc
parent 17578 46ac954e4a84
permissions -rw-r--r--
8034245: Refactor TopLevel tree node. Summary: Added JCPackageDecl to JCTree to store package-level information. Reviewed-by: jjg, jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
     2
 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.javac.tree;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.tools.javac.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import com.sun.tools.javac.tree.JCTree.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
/** A subclass of Tree.Visitor, this class defines
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 *  a general tree scanner pattern. Translation proceeds recursively in
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 *  left-to-right order down a tree. There is one visitor method in this class
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 *  for every possible kind of tree node.  To obtain a specific
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 *  scanner, it suffices to override those visitor methods which
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 *  do some interesting work. The scanner class itself takes care of all
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 *  navigational aspects.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    39
 *  <p><b>This is NOT part of any supported API.
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    40
 *  If you write code that depends on this, you do so at your own risk.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *  This code and its internal interfaces are subject to change or
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 *  deletion without notice.</b>
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
public class TreeScanner extends Visitor {
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
    /** Visitor method: Scan a single node.
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    public void scan(JCTree tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
        if(tree!=null) tree.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
    /** Visitor method: scan a list of nodes.
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    public void scan(List<? extends JCTree> trees) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
        if (trees != null)
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
            scan(l.head);
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
/* ***************************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 * Visitor methods
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 ****************************************************************************/
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    public void visitTopLevel(JCCompilationUnit tree) {
24069
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 17578
diff changeset
    66
        scan(tree.defs);
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 17578
diff changeset
    67
    }
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 17578
diff changeset
    68
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 17578
diff changeset
    69
    public void visitPackageDef(JCPackageDecl tree) {
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 17578
diff changeset
    70
        scan(tree.annotations);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
        scan(tree.pid);
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    public void visitImport(JCImport tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
        scan(tree.qualid);
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    public void visitClassDef(JCClassDecl tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
        scan(tree.mods);
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
        scan(tree.typarams);
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
        scan(tree.extending);
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
        scan(tree.implementing);
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
        scan(tree.defs);
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
    public void visitMethodDef(JCMethodDecl tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
        scan(tree.mods);
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
        scan(tree.restype);
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        scan(tree.typarams);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    90
        scan(tree.recvparam);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
        scan(tree.params);
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
        scan(tree.thrown);
1786
88f03aba5cf9 6512707: "incompatible types" after (unrelated) annotation processing
jjg
parents: 10
diff changeset
    93
        scan(tree.defaultValue);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    public void visitVarDef(JCVariableDecl tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
        scan(tree.mods);
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
        scan(tree.vartype);
17578
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   100
        scan(tree.nameexpr);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        scan(tree.init);
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    public void visitSkip(JCSkip tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    public void visitBlock(JCBlock tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        scan(tree.stats);
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
    public void visitDoLoop(JCDoWhileLoop tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
        scan(tree.cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    public void visitWhileLoop(JCWhileLoop tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
        scan(tree.cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    public void visitForLoop(JCForLoop tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        scan(tree.init);
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        scan(tree.cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        scan(tree.step);
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    public void visitForeachLoop(JCEnhancedForLoop tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        scan(tree.var);
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    public void visitLabelled(JCLabeledStatement tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    public void visitSwitch(JCSwitch tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
        scan(tree.selector);
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
        scan(tree.cases);
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    public void visitCase(JCCase tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
        scan(tree.pat);
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
        scan(tree.stats);
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    public void visitSynchronized(JCSynchronized tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        scan(tree.lock);
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    public void visitTry(JCTry tree) {
6148
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5847
diff changeset
   154
        scan(tree.resources);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        scan(tree.catchers);
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        scan(tree.finalizer);
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
    public void visitCatch(JCCatch tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        scan(tree.param);
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        scan(tree.body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    public void visitConditional(JCConditional tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        scan(tree.cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
        scan(tree.truepart);
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
        scan(tree.falsepart);
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    public void visitIf(JCIf tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
        scan(tree.cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
        scan(tree.thenpart);
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        scan(tree.elsepart);
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
    public void visitExec(JCExpressionStatement tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    public void visitBreak(JCBreak tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
    public void visitContinue(JCContinue tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    public void visitReturn(JCReturn tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
    public void visitThrow(JCThrow tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    public void visitAssert(JCAssert tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        scan(tree.cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        scan(tree.detail);
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
    public void visitApply(JCMethodInvocation tree) {
4877
b642d21c9f74 6923080: TreeScanner.visitNewClass should scan tree.typeargs
jjg
parents: 3149
diff changeset
   201
        scan(tree.typeargs);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
        scan(tree.meth);
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
        scan(tree.args);
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    public void visitNewClass(JCNewClass tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        scan(tree.encl);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   208
        scan(tree.typeargs);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
        scan(tree.clazz);
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
        scan(tree.args);
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
        scan(tree.def);
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
    public void visitNewArray(JCNewArray tree) {
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   215
        scan(tree.annotations);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
        scan(tree.elemtype);
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
        scan(tree.dims);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   218
        for (List<JCAnnotation> annos : tree.dimAnnotations)
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   219
            scan(annos);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
        scan(tree.elems);
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
11141
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 9300
diff changeset
   223
    public void visitLambda(JCLambda tree) {
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 9300
diff changeset
   224
        scan(tree.body);
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 9300
diff changeset
   225
        scan(tree.params);
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 9300
diff changeset
   226
    }
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 9300
diff changeset
   227
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
    public void visitParens(JCParens tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
    public void visitAssign(JCAssign tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        scan(tree.lhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
        scan(tree.rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    public void visitAssignop(JCAssignOp tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
        scan(tree.lhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        scan(tree.rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
    public void visitUnary(JCUnary tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        scan(tree.arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
    public void visitBinary(JCBinary tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
        scan(tree.lhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
        scan(tree.rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    public void visitTypeCast(JCTypeCast tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
        scan(tree.clazz);
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
    public void visitTypeTest(JCInstanceOf tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
        scan(tree.clazz);
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
    public void visitIndexed(JCArrayAccess tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
        scan(tree.indexed);
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
        scan(tree.index);
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    public void visitSelect(JCFieldAccess tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
        scan(tree.selected);
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
11142
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   270
    public void visitReference(JCMemberReference tree) {
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   271
        scan(tree.expr);
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   272
        scan(tree.typeargs);
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   273
    }
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   274
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
    public void visitIdent(JCIdent tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
    public void visitLiteral(JCLiteral tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
    public void visitTypeIdent(JCPrimitiveTypeTree tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
    public void visitTypeArray(JCArrayTypeTree tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        scan(tree.elemtype);
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
    public void visitTypeApply(JCTypeApply tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
        scan(tree.clazz);
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
        scan(tree.arguments);
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
9300
c2de4dd9853b 7033809: Rename "disjunctive" to "union" in javax.lang.model
darcy
parents: 8032
diff changeset
   293
    public void visitTypeUnion(JCTypeUnion tree) {
7074
0183c3f9614e 6949587: rename "DisjointType" to "DisjunctType"
jjg
parents: 6148
diff changeset
   294
        scan(tree.alternatives);
5492
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 4877
diff changeset
   295
    }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 4877
diff changeset
   296
14725
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   297
    public void visitTypeIntersection(JCTypeIntersection tree) {
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   298
        scan(tree.bounds);
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   299
    }
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   300
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    public void visitTypeParameter(JCTypeParameter tree) {
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   302
        scan(tree.annotations);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
        scan(tree.bounds);
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
    @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
    public void visitWildcard(JCWildcard tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
        scan(tree.kind);
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
        if (tree.inner != null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
            scan(tree.inner);
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
    @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
    public void visitTypeBoundKind(TypeBoundKind that) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
    public void visitModifiers(JCModifiers tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
        scan(tree.annotations);
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
    public void visitAnnotation(JCAnnotation tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
        scan(tree.annotationType);
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
        scan(tree.args);
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   326
    public void visitAnnotatedType(JCAnnotatedType tree) {
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   327
        scan(tree.annotations);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   328
        scan(tree.underlyingType);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   329
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   330
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
    public void visitErroneous(JCErroneous tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
    public void visitLetExpr(LetExpr tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
        scan(tree.defs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
        scan(tree.expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
    public void visitTree(JCTree tree) {
8032
e1aa25ccdabb 6396503: javac should not require assertions enabled
jjg
parents: 8031
diff changeset
   340
        Assert.error();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
}