langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java
changeset 14057 b4b0377b8dba
parent 13631 dc1212c348f9
child 14443 91c05eb19277
equal deleted inserted replaced
14056:0ea78d6e0b7b 14057:b4b0377b8dba
    54      */
    54      */
    55     boolean selectSuper = false;
    55     boolean selectSuper = false;
    56 
    56 
    57     /** Are arguments to current function applications boxed into an array for varargs?
    57     /** Are arguments to current function applications boxed into an array for varargs?
    58      */
    58      */
    59     boolean varArgs = false;
    59     Resolve.MethodResolutionPhase pendingResolutionPhase = null;
    60 
    60 
    61     /** A record of the lint/SuppressWarnings currently in effect
    61     /** A record of the lint/SuppressWarnings currently in effect
    62      */
    62      */
    63     Lint lint;
    63     Lint lint;
    64 
    64 
    65     /** The variable whose initializer is being attributed
    65     /** The variable whose initializer is being attributed
    66      * useful for detecting self-references in variable initializers
    66      * useful for detecting self-references in variable initializers
    67      */
    67      */
    68     Symbol enclVar = null;
    68     Symbol enclVar = null;
    69 
    69 
       
    70     /** ResultInfo to be used for attributing 'return' statement expressions
       
    71      * (set by Attr.visitMethod and Attr.visitLambda)
       
    72      */
       
    73     Attr.ResultInfo returnResult = null;
       
    74 
    70     /** Duplicate this context, replacing scope field and copying all others.
    75     /** Duplicate this context, replacing scope field and copying all others.
    71      */
    76      */
    72     AttrContext dup(Scope scope) {
    77     AttrContext dup(Scope scope) {
    73         AttrContext info = new AttrContext();
    78         AttrContext info = new AttrContext();
    74         info.scope = scope;
    79         info.scope = scope;
    75         info.staticLevel = staticLevel;
    80         info.staticLevel = staticLevel;
    76         info.isSelfCall = isSelfCall;
    81         info.isSelfCall = isSelfCall;
    77         info.selectSuper = selectSuper;
    82         info.selectSuper = selectSuper;
    78         info.varArgs = varArgs;
    83         info.pendingResolutionPhase = pendingResolutionPhase;
    79         info.lint = lint;
    84         info.lint = lint;
    80         info.enclVar = enclVar;
    85         info.enclVar = enclVar;
       
    86         info.returnResult = returnResult;
    81         return info;
    87         return info;
    82     }
    88     }
    83 
    89 
    84     /** Duplicate this context, copying all fields.
    90     /** Duplicate this context, copying all fields.
    85      */
    91      */
    91         if (scope == null)
    97         if (scope == null)
    92             return List.nil();
    98             return List.nil();
    93         return scope.getElements();
    99         return scope.getElements();
    94     }
   100     }
    95 
   101 
       
   102     boolean lastResolveVarargs() {
       
   103         return pendingResolutionPhase != null &&
       
   104                 pendingResolutionPhase.isVarargsRequired();
       
   105     }
       
   106 
    96     public String toString() {
   107     public String toString() {
    97         return "AttrContext[" + scope.toString() + "]";
   108         return "AttrContext[" + scope.toString() + "]";
    98     }
   109     }
    99 }
   110 }