[K/N] Internalize KPropertyImpl classes
As a part of efforts to stabilize Native stdlib.
This commit is contained in:
committed by
Space Team
parent
92c39b0107
commit
113d4d8679
@@ -8,7 +8,8 @@ package kotlin.native.internal
|
|||||||
import kotlin.UnsupportedOperationException
|
import kotlin.UnsupportedOperationException
|
||||||
import kotlin.reflect.*
|
import kotlin.reflect.*
|
||||||
|
|
||||||
abstract class KProperty0ImplBase<out R> : KProperty0<R> {
|
@PublishedApi
|
||||||
|
internal abstract class KProperty0ImplBase<out R> : KProperty0<R> {
|
||||||
abstract val getter: KFunction0<R>
|
abstract val getter: KFunction0<R>
|
||||||
override val returnType get() = getter.returnType
|
override val returnType get() = getter.returnType
|
||||||
|
|
||||||
@@ -21,7 +22,8 @@ abstract class KProperty0ImplBase<out R> : KProperty0<R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class KProperty0Impl<out R>(override val name: String, override val getter: KFunction0<R>) : KProperty0ImplBase<R>() {
|
@PublishedApi
|
||||||
|
internal final class KProperty0Impl<out R>(override val name: String, override val getter: KFunction0<R>) : KProperty0ImplBase<R>() {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
val otherKProperty = other as? KProperty0Impl<*>
|
val otherKProperty = other as? KProperty0Impl<*>
|
||||||
if (otherKProperty == null) return false
|
if (otherKProperty == null) return false
|
||||||
@@ -37,7 +39,8 @@ final class KProperty0Impl<out R>(override val name: String, override val getter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class KProperty1ImplBase<T, out R> : KProperty1<T, R> {
|
@PublishedApi
|
||||||
|
internal abstract class KProperty1ImplBase<T, out R> : KProperty1<T, R> {
|
||||||
abstract val getter: KFunction1<T, R>
|
abstract val getter: KFunction1<T, R>
|
||||||
override val returnType get() = getter.returnType
|
override val returnType get() = getter.returnType
|
||||||
|
|
||||||
@@ -50,7 +53,8 @@ abstract class KProperty1ImplBase<T, out R> : KProperty1<T, R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KProperty1Impl<T, out R>(override val name: String, override val getter: KFunction1<T, R>) : KProperty1ImplBase<T, R>() {
|
@PublishedApi
|
||||||
|
internal class KProperty1Impl<T, out R>(override val name: String, override val getter: KFunction1<T, R>) : KProperty1ImplBase<T, R>() {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
val otherKProperty = other as? KProperty1Impl<*, *>
|
val otherKProperty = other as? KProperty1Impl<*, *>
|
||||||
if (otherKProperty == null) return false
|
if (otherKProperty == null) return false
|
||||||
@@ -67,7 +71,8 @@ class KProperty1Impl<T, out R>(override val name: String, override val getter: K
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
abstract class KProperty2ImplBase<T1, T2, out R> : KProperty2<T1, T2, R> {
|
@PublishedApi
|
||||||
|
internal abstract class KProperty2ImplBase<T1, T2, out R> : KProperty2<T1, T2, R> {
|
||||||
abstract val getter: KFunction2<T1, T2, R>
|
abstract val getter: KFunction2<T1, T2, R>
|
||||||
override val returnType get() = getter.returnType
|
override val returnType get() = getter.returnType
|
||||||
|
|
||||||
@@ -80,7 +85,8 @@ abstract class KProperty2ImplBase<T1, T2, out R> : KProperty2<T1, T2, R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KProperty2Impl<T1, T2, out R>(override val name: String, override val getter: KFunction2<T1, T2, R>)
|
@PublishedApi
|
||||||
|
internal class KProperty2Impl<T1, T2, out R>(override val name: String, override val getter: KFunction2<T1, T2, R>)
|
||||||
: KProperty2ImplBase<T1, T2, R>() {
|
: KProperty2ImplBase<T1, T2, R>() {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
val otherKProperty = other as? KProperty2Impl<*, *, *>
|
val otherKProperty = other as? KProperty2Impl<*, *, *>
|
||||||
@@ -98,7 +104,8 @@ class KProperty2Impl<T1, T2, out R>(override val name: String, override val gett
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class KMutableProperty0Impl<R>(override val name: String, override val getter: KFunction0<R>, val setter: (R) -> Unit)
|
@PublishedApi
|
||||||
|
internal class KMutableProperty0Impl<R>(override val name: String, override val getter: KFunction0<R>, val setter: (R) -> Unit)
|
||||||
: KProperty0ImplBase<R>(), KMutableProperty0<R> {
|
: KProperty0ImplBase<R>(), KMutableProperty0<R> {
|
||||||
override fun set(value: R): Unit {
|
override fun set(value: R): Unit {
|
||||||
setter(value)
|
setter(value)
|
||||||
@@ -119,7 +126,8 @@ class KMutableProperty0Impl<R>(override val name: String, override val getter: K
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KMutableProperty1Impl<T, R>(override val name: String, override val getter: KFunction1<T, R>, val setter: (T, R) -> Unit)
|
@PublishedApi
|
||||||
|
internal class KMutableProperty1Impl<T, R>(override val name: String, override val getter: KFunction1<T, R>, val setter: (T, R) -> Unit)
|
||||||
: KProperty1ImplBase<T, R>(), KMutableProperty1<T, R> {
|
: KProperty1ImplBase<T, R>(), KMutableProperty1<T, R> {
|
||||||
override fun set(receiver: T, value: R): Unit {
|
override fun set(receiver: T, value: R): Unit {
|
||||||
setter(receiver, value)
|
setter(receiver, value)
|
||||||
@@ -140,7 +148,8 @@ class KMutableProperty1Impl<T, R>(override val name: String, override val getter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KMutableProperty2Impl<T1, T2, R>(
|
@PublishedApi
|
||||||
|
internal class KMutableProperty2Impl<T1, T2, R>(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
override val getter: KFunction2<T1, T2, R>,
|
override val getter: KFunction2<T1, T2, R>,
|
||||||
val setter: (T1, T2, R) -> Unit)
|
val setter: (T1, T2, R) -> Unit)
|
||||||
@@ -164,7 +173,8 @@ class KMutableProperty2Impl<T1, T2, R>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class KLocalDelegatedPropertyImplBase<out R> : KProperty0<R> {
|
@PublishedApi
|
||||||
|
internal abstract class KLocalDelegatedPropertyImplBase<out R> : KProperty0<R> {
|
||||||
override fun get(): R {
|
override fun get(): R {
|
||||||
throw UnsupportedOperationException("Not supported for local property reference.")
|
throw UnsupportedOperationException("Not supported for local property reference.")
|
||||||
}
|
}
|
||||||
@@ -174,13 +184,15 @@ abstract class KLocalDelegatedPropertyImplBase<out R> : KProperty0<R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KLocalDelegatedPropertyImpl<out R>(override val name: String, override val returnType: KType) : KLocalDelegatedPropertyImplBase<R>() {
|
@PublishedApi
|
||||||
|
internal class KLocalDelegatedPropertyImpl<out R>(override val name: String, override val returnType: KType) : KLocalDelegatedPropertyImplBase<R>() {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "property $name (Kotlin reflection is not available)"
|
return "property $name (Kotlin reflection is not available)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KLocalDelegatedMutablePropertyImpl<R>(override val name: String, override val returnType: KType) :
|
@PublishedApi
|
||||||
|
internal class KLocalDelegatedMutablePropertyImpl<R>(override val name: String, override val returnType: KType) :
|
||||||
KLocalDelegatedPropertyImplBase<R>(), KMutableProperty0<R> {
|
KLocalDelegatedPropertyImplBase<R>(), KMutableProperty0<R> {
|
||||||
override fun set(value: R): Unit {
|
override fun set(value: R): Unit {
|
||||||
throw UnsupportedOperationException("Not supported for local property reference.")
|
throw UnsupportedOperationException("Not supported for local property reference.")
|
||||||
|
|||||||
Reference in New Issue
Block a user