mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-23 18:30:13 +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.contact.QQ
|
||||||
import net.mamoe.mirai.data.EventPacket
|
import net.mamoe.mirai.data.EventPacket
|
||||||
|
import net.mamoe.mirai.utils.getValue
|
||||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||||
import kotlin.jvm.JvmOverloads
|
import kotlin.jvm.JvmOverloads
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import net.mamoe.mirai.contact.MemberPermission
|
|||||||
import net.mamoe.mirai.event.BroadcastControllable
|
import net.mamoe.mirai.event.BroadcastControllable
|
||||||
import net.mamoe.mirai.message.data.At
|
import net.mamoe.mirai.message.data.At
|
||||||
import net.mamoe.mirai.message.data.MessageChain
|
import net.mamoe.mirai.message.data.MessageChain
|
||||||
|
import net.mamoe.mirai.utils.getValue
|
||||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||||
|
|
||||||
@Suppress("unused", "NOTHING_TO_INLINE")
|
@Suppress("unused", "NOTHING_TO_INLINE")
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.utils
|
package net.mamoe.mirai.utils
|
||||||
|
|
||||||
import kotlin.properties.ReadOnlyProperty
|
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,28 +19,7 @@ inline class UnsafeWeakRef<T>(private val weakRef: WeakRef<T>) {
|
|||||||
* val bot: Bot by param.unsafeWeakRef()
|
* val bot: Bot by param.unsafeWeakRef()
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
operator fun <T> UnsafeWeakRef<T>.provideDelegate(thisRef: Any?, property: KProperty<*>): ReadOnlyProperty<Any?, T> {
|
operator fun <T> UnsafeWeakRef<T>.getValue(thisRef: Any?, property: KProperty<*>): T = get()
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weak Reference.
|
* Weak Reference.
|
||||||
|
Loading…
Reference in New Issue
Block a user