use of org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptor in project kotlin by JetBrains.
the class CodegenAnnotatingVisitor method recordSamConstructorIfNeeded.
private void recordSamConstructorIfNeeded(@NotNull KtCallElement expression, @NotNull ResolvedCall<?> call) {
CallableDescriptor callableDescriptor = call.getResultingDescriptor();
if (!(callableDescriptor.getOriginal() instanceof SamConstructorDescriptor))
return;
List<ResolvedValueArgument> valueArguments = call.getValueArgumentsByIndex();
if (valueArguments == null || valueArguments.size() != 1)
return;
ResolvedValueArgument valueArgument = valueArguments.get(0);
if (!(valueArgument instanceof ExpressionValueArgument))
return;
ValueArgument argument = ((ExpressionValueArgument) valueArgument).getValueArgument();
if (argument == null)
return;
KtExpression argumentExpression = argument.getArgumentExpression();
bindingTrace.record(SAM_CONSTRUCTOR_TO_ARGUMENT, expression, argumentExpression);
//noinspection ConstantConditions
SamType samType = SamType.create(callableDescriptor.getReturnType());
bindingTrace.record(SAM_VALUE, argumentExpression, samType);
}
Aggregations