[K/N] Move fields from KFunctionImpl to functions

This commit is contained in:
Pavel Kunyavskiy
2021-06-22 19:25:29 +03:00
committed by Space
parent 7a52ed73de
commit f03c897dc4
3 changed files with 66 additions and 27 deletions
@@ -9,10 +9,21 @@ import kotlin.reflect.KFunction
import kotlin.reflect.KType
@FixmeReflection
internal abstract class KFunctionImpl<out R>(
override val name: String, val fqName: String, val receiver: Any?,
val arity: Int, val flags: Int, override val returnType: KType
): KFunction<R> {
internal abstract class KFunctionImpl<out R>: KFunction<R> {
final override val returnType get() = computeReturnType()
val flags get() = computeFlags()
val arity get() = computeArity()
val fqName get() = computeFqName()
val receiver get() = computeReceiver()
final override val name get() = computeName()
abstract fun computeReturnType() : KType
abstract fun computeFlags() : Int
abstract fun computeArity() : Int
abstract fun computeFqName() : String
abstract fun computeName() : String
open fun computeReceiver(): Any? = null
override fun equals(other: Any?): Boolean {
if (other !is KFunctionImpl<*>) return false
return fqName == other.fqName && receiver == other.receiver
@@ -10,9 +10,6 @@ import kotlin.reflect.KFunction
import kotlin.reflect.KClass
@FixmeReflection
internal abstract class KSuspendFunctionImpl<out R>(
name: String, fqName: String, receiver: Any?,
arity: Int, flags: Int, returnType: KType
): KFunctionImpl<R>(name, fqName, receiver, arity, flags, returnType) {
internal abstract class KSuspendFunctionImpl<out R>: KFunctionImpl<R>() {
override fun toString() = "suspend function $name"
}