[IR] SAM lowering: supported suspend functions
This commit is contained in:
+6
-1
@@ -144,7 +144,11 @@ abstract class SingleAbstractMethodLowering(val context: CommonBackendContext) :
|
|||||||
val superMethod = superClass.functions.single { it.modality == Modality.ABSTRACT }
|
val superMethod = superClass.functions.single { it.modality == Modality.ABSTRACT }
|
||||||
// TODO: have psi2ir cast the argument to the correct function type. Also see the TODO
|
// TODO: have psi2ir cast the argument to the correct function type. Also see the TODO
|
||||||
// about type parameters in `visitTypeOperator`.
|
// about type parameters in `visitTypeOperator`.
|
||||||
val wrappedFunctionClass = context.ir.symbols.functionN(superMethod.valueParameters.size).owner
|
val wrappedFunctionClass =
|
||||||
|
if (superMethod.isSuspend)
|
||||||
|
context.ir.symbols.suspendFunctionN(superMethod.valueParameters.size).owner
|
||||||
|
else
|
||||||
|
context.ir.symbols.functionN(superMethod.valueParameters.size).owner
|
||||||
val wrappedFunctionType = wrappedFunctionClass.defaultType
|
val wrappedFunctionType = wrappedFunctionClass.defaultType
|
||||||
|
|
||||||
val wrapperVisibility = if (generatePublicWrapper) Visibilities.PUBLIC else privateGeneratedWrapperVisibility
|
val wrapperVisibility = if (generatePublicWrapper) Visibilities.PUBLIC else privateGeneratedWrapperVisibility
|
||||||
@@ -188,6 +192,7 @@ abstract class SingleAbstractMethodLowering(val context: CommonBackendContext) :
|
|||||||
returnType = superMethod.returnType
|
returnType = superMethod.returnType
|
||||||
visibility = superMethod.visibility
|
visibility = superMethod.visibility
|
||||||
origin = subclass.origin
|
origin = subclass.origin
|
||||||
|
isSuspend = superMethod.isSuspend
|
||||||
}.apply {
|
}.apply {
|
||||||
overriddenSymbols += superMethod.symbol
|
overriddenSymbols += superMethod.symbol
|
||||||
dispatchReceiverParameter = subclass.thisReceiver!!.copyTo(this)
|
dispatchReceiverParameter = subclass.thisReceiver!!.copyTo(this)
|
||||||
|
|||||||
Reference in New Issue
Block a user