src/share/classes/com/sun/tools/javac/tree/TreeInfo.java

changeset 1510
7873d37f5b37
parent 1455
75ab654b5cd5
child 1521
71f35e4b93a5
     1.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon Jan 21 11:16:28 2013 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon Jan 21 20:13:56 2013 +0000
     1.3 @@ -32,6 +32,7 @@
     1.4  import com.sun.tools.javac.comp.AttrContext;
     1.5  import com.sun.tools.javac.comp.Env;
     1.6  import com.sun.tools.javac.tree.JCTree.*;
     1.7 +import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
     1.8  import com.sun.tools.javac.util.*;
     1.9  import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
    1.10  import static com.sun.tools.javac.code.Flags.*;
    1.11 @@ -264,9 +265,38 @@
    1.12          }
    1.13      }
    1.14  
    1.15 -    public static boolean isExplicitLambda(JCLambda lambda) {
    1.16 -        return lambda.params.isEmpty() ||
    1.17 -                lambda.params.head.vartype != null;
    1.18 +    /** set 'polyKind' on given tree */
    1.19 +    public static void setPolyKind(JCTree tree, PolyKind pkind) {
    1.20 +        switch (tree.getTag()) {
    1.21 +            case APPLY:
    1.22 +                ((JCMethodInvocation)tree).polyKind = pkind;
    1.23 +                break;
    1.24 +            case NEWCLASS:
    1.25 +                ((JCNewClass)tree).polyKind = pkind;
    1.26 +                break;
    1.27 +            case REFERENCE:
    1.28 +                ((JCMemberReference)tree).refPolyKind = pkind;
    1.29 +                break;
    1.30 +            default:
    1.31 +                throw new AssertionError("Unexpected tree: " + tree);
    1.32 +        }
    1.33 +    }
    1.34 +
    1.35 +    /** set 'varargsElement' on given tree */
    1.36 +    public static void setVarargsElement(JCTree tree, Type varargsElement) {
    1.37 +        switch (tree.getTag()) {
    1.38 +            case APPLY:
    1.39 +                ((JCMethodInvocation)tree).varargsElement = varargsElement;
    1.40 +                break;
    1.41 +            case NEWCLASS:
    1.42 +                ((JCNewClass)tree).varargsElement = varargsElement;
    1.43 +                break;
    1.44 +            case REFERENCE:
    1.45 +                ((JCMemberReference)tree).varargsElement = varargsElement;
    1.46 +                break;
    1.47 +            default:
    1.48 +                throw new AssertionError("Unexpected tree: " + tree);
    1.49 +        }
    1.50      }
    1.51  
    1.52      /** Return true if the tree corresponds to an expression statement */

mercurial