Search in sources :

Example 1 with MethodResolutionPhase

use of org.eclipse.ceylon.langtools.tools.javac.comp.Resolve.MethodResolutionPhase in project ceylon by eclipse.

the class Resolve method checkMethod.

Type checkMethod(Env<AttrContext> env, Type site, Symbol m, ResultInfo resultInfo, List<Type> argtypes, List<Type> typeargtypes, Warner warn) {
    MethodResolutionContext prevContext = currentResolutionContext;
    try {
        currentResolutionContext = new MethodResolutionContext();
        currentResolutionContext.attrMode = DeferredAttr.AttrMode.CHECK;
        if (env.tree.hasTag(JCTree.Tag.REFERENCE)) {
            // method/constructor references need special check class
            // to handle inference variables in 'argtypes' (might happen
            // during an unsticking round)
            currentResolutionContext.methodCheck = new MethodReferenceCheck(resultInfo.checkContext.inferenceContext());
        }
        MethodResolutionPhase step = currentResolutionContext.step = env.info.pendingResolutionPhase;
        return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes, step.isBoxingRequired(), step.isVarargsRequired(), warn);
    } finally {
        currentResolutionContext = prevContext;
    }
}
Also used : MethodResolutionPhase(org.eclipse.ceylon.langtools.tools.javac.comp.Resolve.MethodResolutionPhase)

Example 2 with MethodResolutionPhase

use of org.eclipse.ceylon.langtools.tools.javac.comp.Resolve.MethodResolutionPhase in project ceylon by eclipse.

the class Resolve method lookupMethod.

Symbol lookupMethod(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, MethodResolutionContext resolveContext, LookupHelper lookupHelper) {
    MethodResolutionContext prevResolutionContext = currentResolutionContext;
    try {
        Symbol bestSoFar = methodNotFound;
        currentResolutionContext = resolveContext;
        for (MethodResolutionPhase phase : methodResolutionSteps) {
            if (!phase.isApplicable(boxingEnabled, varargsEnabled) || lookupHelper.shouldStop(bestSoFar, phase))
                break;
            MethodResolutionPhase prevPhase = currentResolutionContext.step;
            Symbol prevBest = bestSoFar;
            currentResolutionContext.step = phase;
            Symbol sym = lookupHelper.lookup(env, phase);
            lookupHelper.debug(pos, sym);
            bestSoFar = phase.mergeResults(bestSoFar, sym);
            env.info.pendingResolutionPhase = (prevBest == bestSoFar) ? prevPhase : phase;
        }
        return lookupHelper.access(env, pos, location, bestSoFar);
    } finally {
        currentResolutionContext = prevResolutionContext;
    }
}
Also used : MethodResolutionPhase(org.eclipse.ceylon.langtools.tools.javac.comp.Resolve.MethodResolutionPhase) Symbol(org.eclipse.ceylon.langtools.tools.javac.code.Symbol)

Aggregations

MethodResolutionPhase (org.eclipse.ceylon.langtools.tools.javac.comp.Resolve.MethodResolutionPhase)2 Symbol (org.eclipse.ceylon.langtools.tools.javac.code.Symbol)1