Search in sources :

Example 1 with CallResolutionContext

use of org.jetbrains.kotlin.resolve.calls.context.CallResolutionContext in project kotlin by JetBrains.

the class ArgumentTypeResolver method getArgumentTypeInfo.

@NotNull
public KotlinTypeInfo getArgumentTypeInfo(@Nullable KtExpression expression, @NotNull CallResolutionContext<?> context, @NotNull ResolveArgumentsMode resolveArgumentsMode) {
    if (expression == null) {
        return TypeInfoFactoryKt.noTypeInfo(context);
    }
    KtFunction functionLiteralArgument = getFunctionLiteralArgumentIfAny(expression, context);
    if (functionLiteralArgument != null) {
        return getFunctionLiteralTypeInfo(expression, functionLiteralArgument, context, resolveArgumentsMode);
    }
    KtCallableReferenceExpression callableReferenceExpression = getCallableReferenceExpressionIfAny(expression, context);
    if (callableReferenceExpression != null) {
        return getCallableReferenceTypeInfo(expression, callableReferenceExpression, context, resolveArgumentsMode);
    }
    KotlinTypeInfo recordedTypeInfo = getRecordedTypeInfo(expression, context.trace.getBindingContext());
    if (recordedTypeInfo != null) {
        return recordedTypeInfo;
    }
    ResolutionContext newContext = context.replaceExpectedType(NO_EXPECTED_TYPE).replaceContextDependency(DEPENDENT);
    return expressionTypingServices.getTypeInfo(expression, newContext);
}
Also used : CallResolutionContext(org.jetbrains.kotlin.resolve.calls.context.CallResolutionContext) ResolutionContext(org.jetbrains.kotlin.resolve.calls.context.ResolutionContext) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)1 CallResolutionContext (org.jetbrains.kotlin.resolve.calls.context.CallResolutionContext)1 ResolutionContext (org.jetbrains.kotlin.resolve.calls.context.ResolutionContext)1