0
0
mirror of https://github.com/tursom/TursomServer.git synced 2025-04-26 13:01:22 +08:00

update delegations

This commit is contained in:
tursom 2021-07-15 16:50:52 +08:00
parent 6802e09f83
commit 56b82d0979

View File

@ -33,10 +33,10 @@ val <V> KProperty0<V>.getOwnerDelegated: DelegatedField<*, V>?
* 获取委托过后的值
* 不会触发getter方法
*/
val <V> KProperty0<V>.getDelegatedValue: V?
val <V> KProperty0<V>.getDelegatedValue: V
get() {
val delegate = getDelegate() ?: getOwnerDelegated
return delegate?.castOrNull<DelegatedField<*, V>>()?.getValue()
return delegate?.castOrNull<DelegatedField<*, V>>()?.getValue() ?: get()
}
fun <V> KProperty0<*>.getDelegatedAttachmentValue(key: DelegatedFieldAttachmentKey<V>): V? {