Support handler parameter generation
This commit is contained in:
committed by
Svyatoslav Scherbina
parent
cd54f010e0
commit
f6d47aa93c
+3
-1
@@ -16,9 +16,11 @@ import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
// This is what Context collects about IR.
|
||||
abstract class Ir<out T: CommonBackendContext>(val context: T, val irModule: IrModuleFragment) {
|
||||
|
||||
abstract val symbols: Symbols<T>
|
||||
|
||||
val defaultParameterDeclarationsCache = mutableMapOf<FunctionDescriptor, IrFunction>()
|
||||
|
||||
abstract val symbols: Symbols<T>
|
||||
open fun shouldGenerateHandlerParameterForDefaultBodyFun() = false
|
||||
}
|
||||
|
||||
open class Symbols<out T: CommonBackendContext>(val context: T, private val symbolTable: SymbolTable) {
|
||||
|
||||
+6
@@ -368,6 +368,12 @@ private fun FunctionDescriptor.generateDefaultsFunction(context: CommonBackendCo
|
||||
kConstructorMarkerName,
|
||||
context.ir.symbols.defaultConstructorMarker.owner.defaultType)
|
||||
}
|
||||
else if (context.ir.shouldGenerateHandlerParameterForDefaultBodyFun()) {
|
||||
syntheticParameters += valueParameter(descriptor, syntheticParameters.last().index + 1,
|
||||
"handler".synthesizedName,
|
||||
context.ir.symbols.any.owner.defaultType)
|
||||
}
|
||||
|
||||
descriptor.initialize(
|
||||
/* receiverParameterType = */ extensionReceiverParameter?.type,
|
||||
/* dispatchReceiverParameter = */ dispatchReceiverParameter,
|
||||
|
||||
Reference in New Issue
Block a user