Support KParameter.kind: instance, extension receiver, or value
This commit is contained in:
@@ -36,15 +36,15 @@ interface KCallableImpl<out R> : KCallable<R>, KAnnotatedElementImpl {
|
||||
var index = 0
|
||||
|
||||
if (descriptor.dispatchReceiverParameter != null) {
|
||||
result.add(KParameterImpl(this, index++) { descriptor.dispatchReceiverParameter!! })
|
||||
result.add(KParameterImpl(this, index++, KParameter.Kind.INSTANCE) { descriptor.dispatchReceiverParameter!! })
|
||||
}
|
||||
|
||||
if (descriptor.extensionReceiverParameter != null) {
|
||||
result.add(KParameterImpl(this, index++) { descriptor.extensionReceiverParameter!! })
|
||||
result.add(KParameterImpl(this, index++, KParameter.Kind.EXTENSION_RECEIVER) { descriptor.extensionReceiverParameter!! })
|
||||
}
|
||||
|
||||
for (i in descriptor.valueParameters.indices) {
|
||||
result.add(KParameterImpl(this, index++) { descriptor.valueParameters[i] })
|
||||
result.add(KParameterImpl(this, index++, KParameter.Kind.VALUE) { descriptor.valueParameters[i] })
|
||||
}
|
||||
|
||||
result.trimToSize()
|
||||
|
||||
@@ -25,6 +25,7 @@ import kotlin.reflect.KType
|
||||
class KParameterImpl(
|
||||
val callable: KCallableImpl<*>,
|
||||
override val index: Int,
|
||||
override val kind: KParameter.Kind,
|
||||
computeDescriptor: () -> ParameterDescriptor
|
||||
) : KParameter, KAnnotatedElementImpl {
|
||||
private val descriptor: ParameterDescriptor by ReflectProperties.lazySoft(computeDescriptor)
|
||||
|
||||
Reference in New Issue
Block a user