mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-23 10:20:14 +08:00
Fix unresolved references
This commit is contained in:
parent
13d751c222
commit
fea268d31f
@ -2,6 +2,7 @@ package net.mamoe.mirai.event.events
|
||||
|
||||
import net.mamoe.mirai.contact.QQ
|
||||
import net.mamoe.mirai.data.EventPacket
|
||||
import net.mamoe.mirai.utils.getValue
|
||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||
import kotlin.jvm.JvmOverloads
|
||||
|
||||
|
@ -7,6 +7,7 @@ import net.mamoe.mirai.contact.MemberPermission
|
||||
import net.mamoe.mirai.event.BroadcastControllable
|
||||
import net.mamoe.mirai.message.data.At
|
||||
import net.mamoe.mirai.message.data.MessageChain
|
||||
import net.mamoe.mirai.utils.getValue
|
||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||
|
||||
@Suppress("unused", "NOTHING_TO_INLINE")
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
package net.mamoe.mirai.utils
|
||||
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
/**
|
||||
@ -20,28 +19,7 @@ inline class UnsafeWeakRef<T>(private val weakRef: WeakRef<T>) {
|
||||
* val bot: Bot by param.unsafeWeakRef()
|
||||
* ```
|
||||
*/
|
||||
operator fun <T> UnsafeWeakRef<T>.provideDelegate(thisRef: Any?, property: KProperty<*>): ReadOnlyProperty<Any?, T> {
|
||||
return object : ReadOnlyProperty<Any?, T> {
|
||||
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
|
||||
return get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides delegate value.
|
||||
*
|
||||
* ```kotlin
|
||||
* val bot: Bot? by param.weakRef()
|
||||
* ```
|
||||
*/
|
||||
operator fun <T> WeakRef<T>.provideDelegate(thisRef: Any?, property: KProperty<*>): ReadOnlyProperty<Any?, T?> {
|
||||
return object : ReadOnlyProperty<Any?, T?> {
|
||||
override fun getValue(thisRef: Any?, property: KProperty<*>): T? {
|
||||
return get()
|
||||
}
|
||||
}
|
||||
}
|
||||
operator fun <T> UnsafeWeakRef<T>.getValue(thisRef: Any?, property: KProperty<*>): T = get()
|
||||
|
||||
/**
|
||||
* Weak Reference.
|
||||
|
Loading…
Reference in New Issue
Block a user