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