private void checkValueParameter( @NotNull BasicCallResolutionContext context, @NotNull CallableDescriptor targetDescriptor, @NotNull ValueArgument targetArgument, @NotNull ValueParameterDescriptor targetParameterDescriptor) { JetExpression argumentExpression = targetArgument.getArgumentExpression(); if (argumentExpression == null) { return; } CallableDescriptor argumentCallee = getCalleeDescriptor(context, argumentExpression, false); if (argumentCallee != null && inlinableParameters.contains(argumentCallee)) { boolean isTargetInlineFunction = targetDescriptor instanceof SimpleFunctionDescriptor && ((SimpleFunctionDescriptor) targetDescriptor).getInlineStrategy().isInline(); if (!isTargetInlineFunction || !isInlinableParameter(targetParameterDescriptor)) { context.trace.report( Errors.USAGE_IS_NOT_INLINABLE.on(argumentExpression, argumentExpression, descriptor)); } else { if (allowsNonLocalReturns(argumentCallee) && !allowsNonLocalReturns(targetParameterDescriptor)) { context.trace.report( Errors.NON_LOCAL_RETURN_NOT_ALLOWED.on( argumentExpression, argumentExpression, argumentCallee, descriptor)); } else { checkNonLocalReturn(context, argumentCallee, argumentExpression); } } } }
private void checkNonLocalReturn( @NotNull BasicCallResolutionContext context, @NotNull CallableDescriptor inlinableParameterDescriptor, @NotNull JetExpression parameterUsage) { if (!allowsNonLocalReturns(inlinableParameterDescriptor)) return; if (!checkNonLocalReturnUsage(descriptor, parameterUsage, context.trace)) { context.trace.report( Errors.NON_LOCAL_RETURN_NOT_ALLOWED.on( parameterUsage, parameterUsage, inlinableParameterDescriptor, descriptor)); } }