Do not generate suspend markers inside callable reference
#KT-41429 #KT-25519 Fixed
This commit is contained in:
@@ -2690,7 +2690,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
|
|
||||||
SuspensionPointKind suspensionPointKind =
|
SuspensionPointKind suspensionPointKind =
|
||||||
CoroutineCodegenUtilKt.isSuspensionPoint(resolvedCall, this, state.getLanguageVersionSettings());
|
CoroutineCodegenUtilKt.isSuspensionPoint(resolvedCall, this, state.getLanguageVersionSettings());
|
||||||
boolean maybeSuspensionPoint = suspensionPointKind != SuspensionPointKind.NEVER;
|
boolean maybeSuspensionPoint = suspensionPointKind != SuspensionPointKind.NEVER && !insideCallableReference();
|
||||||
boolean isConstructor = resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor;
|
boolean isConstructor = resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor;
|
||||||
if (!(callableMethod instanceof IntrinsicWithSpecialReceiver)) {
|
if (!(callableMethod instanceof IntrinsicWithSpecialReceiver)) {
|
||||||
putReceiverAndInlineMarkerIfNeeded(callableMethod, resolvedCall, receiver, maybeSuspensionPoint, isConstructor);
|
putReceiverAndInlineMarkerIfNeeded(callableMethod, resolvedCall, receiver, maybeSuspensionPoint, isConstructor);
|
||||||
@@ -2755,6 +2755,11 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean insideCallableReference() {
|
||||||
|
return (parentCodegen instanceof ClosureCodegen) &&
|
||||||
|
((ClosureCodegen) parentCodegen).superClassAsmType.equals(FUNCTION_REFERENCE_IMPL);
|
||||||
|
}
|
||||||
|
|
||||||
private void putReceiverAndInlineMarkerIfNeeded(
|
private void putReceiverAndInlineMarkerIfNeeded(
|
||||||
@NotNull Callable callableMethod,
|
@NotNull Callable callableMethod,
|
||||||
@NotNull ResolvedCall<?> resolvedCall,
|
@NotNull ResolvedCall<?> resolvedCall,
|
||||||
|
|||||||
Reference in New Issue
Block a user