src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java
author jlahoda
Tue, 12 Nov 2019 06:32:13 +0000
changeset 59021 cfc7bb9a5a92
parent 58713 ad69fd32778e
child 59285 7799a51dbe30
permissions -rw-r--r--
8232684: Make switch expressions final Reviewed-by: alanb, mcimadamore, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
55306
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
     2
 * Copyright (c) 2006, 2019, 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.source.tree.*;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
    29
import com.sun.source.tree.Tree.Kind;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.tools.javac.tree.JCTree.*;
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
    31
import com.sun.tools.javac.util.DefinedBy;
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
    32
import com.sun.tools.javac.util.DefinedBy.Api;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import com.sun.tools.javac.util.List;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
import com.sun.tools.javac.util.ListBuffer;
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * Creates a copy of a tree, using a given TreeMaker.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * Names, literal values, etc are shared with the original.
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    40
 *  <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
    41
 *  If you write code that depends on this, you do so at your own risk.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 *  This code and its internal interfaces are subject to change or
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 *  deletion without notice.</b>
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
public class TreeCopier<P> implements TreeVisitor<JCTree,P> {
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
    private TreeMaker M;
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    /** Creates a new instance of TreeCopier */
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    public TreeCopier(TreeMaker M) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
        this.M = M;
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    public <T extends JCTree> T copy(T tree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
        return copy(tree, null);
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    @SuppressWarnings("unchecked")
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
    public <T extends JCTree> T copy(T tree, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
        if (tree == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
            return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        return (T) (tree.accept(this, p));
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    public <T extends JCTree> List<T> copy(List<T> trees) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        return copy(trees, null);
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    public <T extends JCTree> List<T> copy(List<T> trees, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
        if (trees == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
            return null;
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 20243
diff changeset
    71
        ListBuffer<T> lb = new ListBuffer<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
        for (T tree: trees)
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
            lb.append(copy(tree, p));
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
        return lb.toList();
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
    77
    @DefinedBy(Api.COMPILER_TREE)
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    78
    public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) {
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    79
        JCAnnotatedType t = (JCAnnotatedType) node;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    80
        List<JCAnnotation> annotations = copy(t.annotations, p);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    81
        JCExpression underlyingType = copy(t.underlyingType, p);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    82
        return M.at(t.pos).AnnotatedType(annotations, underlyingType);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    83
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    84
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
    85
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
    public JCTree visitAnnotation(AnnotationTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
        JCAnnotation t = (JCAnnotation) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
        JCTree annotationType = copy(t.annotationType, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        List<JCExpression> args = copy(t.args, p);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    90
        if (t.getKind() == Tree.Kind.TYPE_ANNOTATION) {
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    91
            JCAnnotation newTA = M.at(t.pos).TypeAnnotation(annotationType, args);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    92
            newTA.attribute = t.attribute;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    93
            return newTA;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    94
        } else {
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    95
            JCAnnotation newT = M.at(t.pos).Annotation(annotationType, args);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    96
            newT.attribute = t.attribute;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    97
            return newT;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
    98
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   101
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    public JCTree visitAssert(AssertTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        JCAssert t = (JCAssert) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
        JCExpression cond = copy(t.cond, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
        JCExpression detail = copy(t.detail, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
        return M.at(t.pos).Assert(cond, detail);
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   109
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    public JCTree visitAssignment(AssignmentTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
        JCAssign t = (JCAssign) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
        JCExpression lhs = copy(t.lhs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
        JCExpression rhs = copy(t.rhs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        return M.at(t.pos).Assign(lhs, rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   117
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    public JCTree visitCompoundAssignment(CompoundAssignmentTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        JCAssignOp t = (JCAssignOp) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        JCTree lhs = copy(t.lhs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        JCTree rhs = copy(t.rhs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        return M.at(t.pos).Assignop(t.getTag(), lhs, rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   125
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    public JCTree visitBinary(BinaryTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
        JCBinary t = (JCBinary) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
        JCExpression lhs = copy(t.lhs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        JCExpression rhs = copy(t.rhs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
        return M.at(t.pos).Binary(t.getTag(), lhs, rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   133
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    public JCTree visitBlock(BlockTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
        JCBlock t = (JCBlock) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        List<JCStatement> stats = copy(t.stats, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        return M.at(t.pos).Block(t.flags, stats);
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   140
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    public JCTree visitBreak(BreakTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        JCBreak t = (JCBreak) node;
55306
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
   143
        return M.at(t.pos).Break(t.label);
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
   144
    }
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
   145
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
   146
    @DefinedBy(Api.COMPILER_TREE)
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
   147
    public JCTree visitYield(YieldTree node, P p) {
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
   148
        JCYield t = (JCYield) node;
51563
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   149
        JCExpression value = copy(t.value, p);
55306
ea43db53de91 8223305: Compiler support for Switch Expressions
jlahoda
parents: 51563
diff changeset
   150
        return M.at(t.pos).Yield(value);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   153
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    public JCTree visitCase(CaseTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
        JCCase t = (JCCase) node;
51563
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   156
        List<JCExpression> pats = copy(t.pats, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        List<JCStatement> stats = copy(t.stats, p);
51563
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   158
        JCTree body = copy(t.body, p);
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   159
        return M.at(t.pos).Case(t.caseKind, pats, stats, body);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   162
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    public JCTree visitCatch(CatchTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
        JCCatch t = (JCCatch) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        JCVariableDecl param = copy(t.param, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        JCBlock body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
        return M.at(t.pos).Catch(param, body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   170
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    public JCTree visitClass(ClassTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
        JCClassDecl t = (JCClassDecl) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
        JCModifiers mods = copy(t.mods, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        List<JCTypeParameter> typarams = copy(t.typarams, p);
8625
6b51ef804d49 6639645: Modeling type implementing missing interfaces
jjg
parents: 8031
diff changeset
   175
        JCExpression extending = copy(t.extending, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        List<JCExpression> implementing = copy(t.implementing, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
        List<JCTree> defs = copy(t.defs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
        return M.at(t.pos).ClassDef(mods, t.name, typarams, extending, implementing, defs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   181
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
    public JCTree visitConditionalExpression(ConditionalExpressionTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        JCConditional t = (JCConditional) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
        JCExpression cond = copy(t.cond, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
        JCExpression truepart = copy(t.truepart, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
        JCExpression falsepart = copy(t.falsepart, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
        return M.at(t.pos).Conditional(cond, truepart, falsepart);
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   190
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
    public JCTree visitContinue(ContinueTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
        JCContinue t = (JCContinue) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
        return M.at(t.pos).Continue(t.label);
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   196
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    public JCTree visitDoWhileLoop(DoWhileLoopTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
        JCDoWhileLoop t = (JCDoWhileLoop) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
        JCStatement body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
        JCExpression cond = copy(t.cond, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
        return M.at(t.pos).DoLoop(body, cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   204
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    public JCTree visitErroneous(ErroneousTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
        JCErroneous t = (JCErroneous) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        List<? extends JCTree> errs = copy(t.errs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
        return M.at(t.pos).Erroneous(errs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   211
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
    public JCTree visitExpressionStatement(ExpressionStatementTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
        JCExpressionStatement t = (JCExpressionStatement) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
        JCExpression expr = copy(t.expr, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
        return M.at(t.pos).Exec(expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   218
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    public JCTree visitEnhancedForLoop(EnhancedForLoopTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
        JCEnhancedForLoop t = (JCEnhancedForLoop) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
        JCVariableDecl var = copy(t.var, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        JCExpression expr = copy(t.expr, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
        JCStatement body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
        return M.at(t.pos).ForeachLoop(var, expr, body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   227
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
    public JCTree visitForLoop(ForLoopTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
        JCForLoop t = (JCForLoop) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
        List<JCStatement> init = copy(t.init, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
        JCExpression cond = copy(t.cond, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        List<JCExpressionStatement> step = copy(t.step, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        JCStatement body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
        return M.at(t.pos).ForLoop(init, cond, step, body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   237
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
    public JCTree visitIdentifier(IdentifierTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        JCIdent t = (JCIdent) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        return M.at(t.pos).Ident(t.name);
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   243
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
    public JCTree visitIf(IfTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
        JCIf t = (JCIf) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
        JCExpression cond = copy(t.cond, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
        JCStatement thenpart = copy(t.thenpart, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
        JCStatement elsepart = copy(t.elsepart, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
        return M.at(t.pos).If(cond, thenpart, elsepart);
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   252
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    public JCTree visitImport(ImportTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
        JCImport t = (JCImport) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
        JCTree qualid = copy(t.qualid, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
        return M.at(t.pos).Import(qualid, t.staticImport);
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   259
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
    public JCTree visitArrayAccess(ArrayAccessTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
        JCArrayAccess t = (JCArrayAccess) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
        JCExpression indexed = copy(t.indexed, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
        JCExpression index = copy(t.index, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
        return M.at(t.pos).Indexed(indexed, index);
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   267
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
    public JCTree visitLabeledStatement(LabeledStatementTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
        JCLabeledStatement t = (JCLabeledStatement) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        JCStatement body = copy(t.body, p);
20243
21740b37e9aa 8025110: TreeCopier does not correctly copy LabeledStatementTree
jjg
parents: 17807
diff changeset
   271
        return M.at(t.pos).Labelled(t.label, body);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   274
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
    public JCTree visitLiteral(LiteralTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
        JCLiteral t = (JCLiteral) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
        return M.at(t.pos).Literal(t.typetag, t.value);
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   280
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
    public JCTree visitMethod(MethodTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
        JCMethodDecl t  = (JCMethodDecl) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
        JCModifiers mods = copy(t.mods, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
        JCExpression restype = copy(t.restype, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        List<JCTypeParameter> typarams = copy(t.typarams, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
        List<JCVariableDecl> params = copy(t.params, p);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   287
        JCVariableDecl recvparam = copy(t.recvparam, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        List<JCExpression> thrown = copy(t.thrown, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
        JCBlock body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
        JCExpression defaultValue = copy(t.defaultValue, p);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   291
        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, recvparam, params, thrown, body, defaultValue);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   294
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
    public JCTree visitMethodInvocation(MethodInvocationTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
        JCMethodInvocation t = (JCMethodInvocation) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        List<JCExpression> typeargs = copy(t.typeargs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        JCExpression meth = copy(t.meth, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
        List<JCExpression> args = copy(t.args, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
        return M.at(t.pos).Apply(typeargs, meth, args);
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   303
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
    public JCTree visitModifiers(ModifiersTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
        JCModifiers t = (JCModifiers) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
        List<JCAnnotation> annotations = copy(t.annotations, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
        return M.at(t.pos).Modifiers(t.flags, annotations);
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   310
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
    public JCTree visitNewArray(NewArrayTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        JCNewArray t = (JCNewArray) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
        JCExpression elemtype = copy(t.elemtype, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
        List<JCExpression> dims = copy(t.dims, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
        List<JCExpression> elems = copy(t.elems, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
        return M.at(t.pos).NewArray(elemtype, dims, elems);
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   319
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
    public JCTree visitNewClass(NewClassTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
        JCNewClass t = (JCNewClass) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
        JCExpression encl = copy(t.encl, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
        List<JCExpression> typeargs = copy(t.typeargs, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
        JCExpression clazz = copy(t.clazz, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
        List<JCExpression> args = copy(t.args, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
        JCClassDecl def = copy(t.def, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
        return M.at(t.pos).NewClass(encl, typeargs, clazz, args, def);
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   330
    @DefinedBy(Api.COMPILER_TREE)
11141
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 10950
diff changeset
   331
    public JCTree visitLambdaExpression(LambdaExpressionTree node, P p) {
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 10950
diff changeset
   332
        JCLambda t = (JCLambda) node;
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 10950
diff changeset
   333
        List<JCVariableDecl> params = copy(t.params, p);
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 10950
diff changeset
   334
        JCTree body = copy(t.body, p);
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 10950
diff changeset
   335
        return M.at(t.pos).Lambda(params, body);
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 10950
diff changeset
   336
    }
7d112a1ecd0f 7115046: Add AST node for lambda expressions
mcimadamore
parents: 10950
diff changeset
   337
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   338
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
    public JCTree visitParenthesized(ParenthesizedTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
        JCParens t = (JCParens) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
        JCExpression expr = copy(t.expr, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
        return M.at(t.pos).Parens(expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   345
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
    public JCTree visitReturn(ReturnTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
        JCReturn t = (JCReturn) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
        JCExpression expr = copy(t.expr, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
        return M.at(t.pos).Return(expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   352
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
    public JCTree visitMemberSelect(MemberSelectTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
        JCFieldAccess t = (JCFieldAccess) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
        JCExpression selected = copy(t.selected, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
        return M.at(t.pos).Select(selected, t.name);
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   359
    @DefinedBy(Api.COMPILER_TREE)
11142
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   360
    public JCTree visitMemberReference(MemberReferenceTree node, P p) {
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   361
        JCMemberReference t = (JCMemberReference) node;
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   362
        JCExpression expr = copy(t.expr, p);
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   363
        List<JCExpression> typeargs = copy(t.typeargs, p);
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   364
        return M.at(t.pos).Reference(t.mode, t.name, expr, typeargs);
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   365
    }
45d0ec1e7463 7115049: Add AST node for method references
mcimadamore
parents: 11141
diff changeset
   366
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   367
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
    public JCTree visitEmptyStatement(EmptyStatementTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
        JCSkip t = (JCSkip) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
        return M.at(t.pos).Skip();
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   373
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
    public JCTree visitSwitch(SwitchTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
        JCSwitch t = (JCSwitch) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
        JCExpression selector = copy(t.selector, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
        List<JCCase> cases = copy(t.cases, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
        return M.at(t.pos).Switch(selector, cases);
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   381
    @DefinedBy(Api.COMPILER_TREE)
51563
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   382
    public JCTree visitSwitchExpression(SwitchExpressionTree node, P p) {
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   383
        JCSwitchExpression t = (JCSwitchExpression) node;
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   384
        JCExpression selector = copy(t.selector, p);
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   385
        List<JCCase> cases = copy(t.cases, p);
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   386
        return M.at(t.pos).SwitchExpression(selector, cases);
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   387
    }
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   388
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   389
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    public JCTree visitSynchronized(SynchronizedTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
        JCSynchronized t = (JCSynchronized) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
        JCExpression lock = copy(t.lock, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
        JCBlock body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
        return M.at(t.pos).Synchronized(lock, body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   397
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
    public JCTree visitThrow(ThrowTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
        JCThrow t = (JCThrow) node;
17807
36cff8c58cdf 7030476: Fix conflicting use of JCTree/JCExpression
vromero
parents: 17578
diff changeset
   400
        JCExpression expr = copy(t.expr, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
        return M.at(t.pos).Throw(expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   404
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
    public JCTree visitCompilationUnit(CompilationUnitTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
        JCCompilationUnit t = (JCCompilationUnit) node;
24069
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   407
        List<JCTree> defs = copy(t.defs, p);
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   408
        return M.at(t.pos).TopLevel(defs);
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   409
    }
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   410
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   411
    @DefinedBy(Api.COMPILER_TREE)
24069
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   412
    public JCTree visitPackage(PackageTree node, P p) {
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   413
        JCPackageDecl t = (JCPackageDecl) node;
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   414
        List<JCAnnotation> annotations = copy(t.annotations, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
        JCExpression pid = copy(t.pid, p);
24069
dfb8f11542fc 8034245: Refactor TopLevel tree node.
pgovereau
parents: 22163
diff changeset
   416
        return M.at(t.pos).PackageDecl(annotations, pid);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   419
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
    public JCTree visitTry(TryTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
        JCTry t = (JCTry) node;
6148
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5847
diff changeset
   422
        List<JCTree> resources = copy(t.resources, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
        JCBlock body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
        List<JCCatch> catchers = copy(t.catchers, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
        JCBlock finalizer = copy(t.finalizer, p);
6148
3a8158299c51 6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents: 5847
diff changeset
   426
        return M.at(t.pos).Try(resources, body, catchers, finalizer);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   429
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
    public JCTree visitParameterizedType(ParameterizedTypeTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
        JCTypeApply t = (JCTypeApply) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
        JCExpression clazz = copy(t.clazz, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
        List<JCExpression> arguments = copy(t.arguments, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
        return M.at(t.pos).TypeApply(clazz, arguments);
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   437
    @DefinedBy(Api.COMPILER_TREE)
9300
c2de4dd9853b 7033809: Rename "disjunctive" to "union" in javax.lang.model
darcy
parents: 8625
diff changeset
   438
    public JCTree visitUnionType(UnionTypeTree node, P p) {
c2de4dd9853b 7033809: Rename "disjunctive" to "union" in javax.lang.model
darcy
parents: 8625
diff changeset
   439
        JCTypeUnion t = (JCTypeUnion) node;
7074
0183c3f9614e 6949587: rename "DisjointType" to "DisjunctType"
jjg
parents: 7072
diff changeset
   440
        List<JCExpression> components = copy(t.alternatives, p);
9300
c2de4dd9853b 7033809: Rename "disjunctive" to "union" in javax.lang.model
darcy
parents: 8625
diff changeset
   441
        return M.at(t.pos).TypeUnion(components);
5492
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
   442
    }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
   443
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   444
    @DefinedBy(Api.COMPILER_TREE)
14725
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   445
    public JCTree visitIntersectionType(IntersectionTypeTree node, P p) {
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   446
        JCTypeIntersection t = (JCTypeIntersection) node;
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   447
        List<JCExpression> bounds = copy(t.bounds, p);
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   448
        return M.at(t.pos).TypeIntersection(bounds);
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   449
    }
65836e833f59 8002099: Add support for intersection types in cast expression
mcimadamore
parents: 11142
diff changeset
   450
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   451
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
    public JCTree visitArrayType(ArrayTypeTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
        JCArrayTypeTree t = (JCArrayTypeTree) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
        JCExpression elemtype = copy(t.elemtype, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
        return M.at(t.pos).TypeArray(elemtype);
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   458
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
    public JCTree visitTypeCast(TypeCastTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
        JCTypeCast t = (JCTypeCast) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
        JCTree clazz = copy(t.clazz, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
        JCExpression expr = copy(t.expr, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
        return M.at(t.pos).TypeCast(clazz, expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   466
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
    public JCTree visitPrimitiveType(PrimitiveTypeTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
        JCPrimitiveTypeTree t = (JCPrimitiveTypeTree) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
        return M.at(t.pos).TypeIdent(t.typetag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   472
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
    public JCTree visitTypeParameter(TypeParameterTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
        JCTypeParameter t = (JCTypeParameter) node;
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   475
        List<JCAnnotation> annos = copy(t.annotations, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
        List<JCExpression> bounds = copy(t.bounds, p);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 14725
diff changeset
   477
        return M.at(t.pos).TypeParameter(t.name, bounds, annos);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   480
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
    public JCTree visitInstanceOf(InstanceOfTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
        JCInstanceOf t = (JCInstanceOf) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
        JCExpression expr = copy(t.expr, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
        JCTree clazz = copy(t.clazz, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
        return M.at(t.pos).TypeTest(expr, clazz);
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   488
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
    public JCTree visitUnary(UnaryTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
        JCUnary t = (JCUnary) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
        JCExpression arg = copy(t.arg, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
        return M.at(t.pos).Unary(t.getTag(), arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   495
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
    public JCTree visitVariable(VariableTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
        JCVariableDecl t = (JCVariableDecl) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
        JCModifiers mods = copy(t.mods, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
        JCExpression vartype = copy(t.vartype, p);
17578
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   500
        if (t.nameexpr == null) {
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   501
            JCExpression init = copy(t.init, p);
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   502
            return M.at(t.pos).VarDef(mods, t.name, vartype, init);
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   503
        } else {
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   504
            JCExpression nameexpr = copy(t.nameexpr, p);
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   505
            return M.at(t.pos).ReceiverVarDef(mods, nameexpr, vartype);
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15385
diff changeset
   506
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   509
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
    public JCTree visitWhileLoop(WhileLoopTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
        JCWhileLoop t = (JCWhileLoop) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
        JCStatement body = copy(t.body, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
        JCExpression cond = copy(t.cond, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
        return M.at(t.pos).WhileLoop(cond, body);
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   517
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
    public JCTree visitWildcard(WildcardTree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
        JCWildcard t = (JCWildcard) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
        TypeBoundKind kind = M.at(t.kind.pos).TypeBoundKind(t.kind.kind);
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
        JCTree inner = copy(t.inner, p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
        return M.at(t.pos).Wildcard(kind, inner);
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
37848
3c8ff4204d2d 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36526
diff changeset
   525
    @Override @DefinedBy(Api.COMPILER_TREE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   526
    public JCTree visitModule(ModuleTree node, P p) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   527
        JCModuleDecl t = (JCModuleDecl) node;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   528
        JCModifiers mods = copy(t.mods, p);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   529
        JCExpression qualId = copy(t.qualId);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   530
        List<JCDirective> directives = copy(t.directives);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   531
        return M.at(t.pos).ModuleDef(mods, t.getModuleType(), qualId, directives);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   532
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   533
37848
3c8ff4204d2d 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36526
diff changeset
   534
    @Override @DefinedBy(Api.COMPILER_TREE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   535
    public JCExports visitExports(ExportsTree node, P p) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   536
        JCExports t = (JCExports) node;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   537
        JCExpression qualId = copy(t.qualid, p);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   538
        List<JCExpression> moduleNames = copy(t.moduleNames, p);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   539
        return M.at(t.pos).Exports(qualId, moduleNames);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   540
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   541
37848
3c8ff4204d2d 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36526
diff changeset
   542
    @Override @DefinedBy(Api.COMPILER_TREE)
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   543
    public JCOpens visitOpens(OpensTree node, P p) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   544
        JCOpens t = (JCOpens) node;
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   545
        JCExpression qualId = copy(t.qualid, p);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   546
        List<JCExpression> moduleNames = copy(t.moduleNames, p);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   547
        return M.at(t.pos).Opens(qualId, moduleNames);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   548
    }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   549
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   550
    @Override @DefinedBy(Api.COMPILER_TREE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   551
    public JCProvides visitProvides(ProvidesTree node, P p) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   552
        JCProvides t = (JCProvides) node;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   553
        JCExpression serviceName = copy(t.serviceName, p);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   554
        List<JCExpression> implNames = copy(t.implNames, p);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   555
        return M.at(t.pos).Provides(serviceName, implNames);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   556
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   557
37848
3c8ff4204d2d 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36526
diff changeset
   558
    @Override @DefinedBy(Api.COMPILER_TREE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   559
    public JCRequires visitRequires(RequiresTree node, P p) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   560
        JCRequires t = (JCRequires) node;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   561
        JCExpression moduleName = copy(t.moduleName, p);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37848
diff changeset
   562
        return M.at(t.pos).Requires(t.isTransitive, t.isStaticPhase, moduleName);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   563
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   564
37848
3c8ff4204d2d 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36526
diff changeset
   565
    @Override @DefinedBy(Api.COMPILER_TREE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   566
    public JCUses visitUses(UsesTree node, P p) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   567
        JCUses t = (JCUses) node;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   568
        JCExpression serviceName = copy(t.qualid, p);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   569
        return M.at(t.pos).Uses(serviceName);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   570
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33707
diff changeset
   571
26266
2d24bda701dc 8056061: Mark implementations of public interfaces with an annotation
jlahoda
parents: 25874
diff changeset
   572
    @DefinedBy(Api.COMPILER_TREE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
    public JCTree visitOther(Tree node, P p) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
        JCTree tree = (JCTree) node;
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
        switch (tree.getTag()) {
10950
e87b50888909 6921494: provide way to print javac tree tag values
jjg
parents: 9300
diff changeset
   576
            case LETEXPR: {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
                LetExpr t = (LetExpr) node;
51563
de411d537aae 8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents: 47216
diff changeset
   578
                List<JCStatement> defs = copy(t.defs, p);
33707
d74fef6b01e0 8141639: Signatures in Lower could be made tighter by using JCExpression instead of JCTree
mcimadamore
parents: 26266
diff changeset
   579
                JCExpression expr = copy(t.expr, p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
                return M.at(t.pos).LetExpr(defs, expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
            default:
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
                throw new AssertionError("unknown tree tag: " + tree.getTag());
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   585
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   586
06bc494ca11e Initial load
duke
parents:
diff changeset
   587
}