From 8b421ec45cf9008334988be52f84ea1d8fd4a638 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 1 Aug 2020 22:10:56 +0800 Subject: [PATCH] Remove improper inline functions --- .../net.mamoe.mirai/message/MessageEvent.kt | 27 ++++++------ .../mirai/message/MessageEventPlatform.kt | 42 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageEvent.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageEvent.kt index 04d72fffe..e1f6ad918 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageEvent.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageEvent.kt @@ -10,8 +10,7 @@ @file:Suppress( "EXPERIMENTAL_UNSIGNED_LITERALS", "EXPERIMENTAL_API_USAGE", - "unused", - "DECLARATION_CANT_BE_INLINED", "UNCHECKED_CAST", "NOTHING_TO_INLINE" + "unused", "UNCHECKED_CAST", "NOTHING_TO_INLINE" ) @file:JvmMultifileClass @@ -105,29 +104,29 @@ public interface MessageEventExtensions = + public suspend fun reply(message: Message): MessageReceipt = subject.sendMessage(message.asMessageChain()) as MessageReceipt @JvmSynthetic - public suspend inline fun reply(plain: String): MessageReceipt = + public suspend fun reply(plain: String): MessageReceipt = subject.sendMessage(plain.toMessage().asMessageChain()) as MessageReceipt // endregion @JvmSynthetic - public suspend inline fun ExternalImage.upload(): Image = this.upload(subject) + public suspend fun ExternalImage.upload(): Image = this.upload(subject) @JvmSynthetic - public suspend inline fun ExternalImage.send(): MessageReceipt = this.sendTo(subject) + public suspend fun ExternalImage.send(): MessageReceipt = this.sendTo(subject) @JvmSynthetic - public suspend inline fun Image.send(): MessageReceipt = this.sendTo(subject) + public suspend fun Image.send(): MessageReceipt = this.sendTo(subject) @JvmSynthetic - public suspend inline fun Message.send(): MessageReceipt = this.sendTo(subject) + public suspend fun Message.send(): MessageReceipt = this.sendTo(subject) @JvmSynthetic - public suspend inline fun String.send(): MessageReceipt = this.toMessage().sendTo(subject) + public suspend fun String.send(): MessageReceipt = this.toMessage().sendTo(subject) // region 引用回复 /** @@ -136,18 +135,18 @@ public interface MessageEventExtensions = + public suspend fun quoteReply(message: MessageChain): MessageReceipt = reply(this.message.quote() + message) @JvmSynthetic - public suspend inline fun quoteReply(message: Message): MessageReceipt = + public suspend fun quoteReply(message: Message): MessageReceipt = reply(this.message.quote() + message) @JvmSynthetic - public suspend inline fun quoteReply(plain: String): MessageReceipt = reply(this.message.quote() + plain) + public suspend fun quoteReply(plain: String): MessageReceipt = reply(this.message.quote() + plain) @JvmSynthetic - public inline fun At.isBot(): Boolean = target == bot.id + public fun At.isBot(): Boolean = target == bot.id /** @@ -155,7 +154,7 @@ public interface MessageEventExtensions = subject.sendImage(image) + suspend fun sendImage(image: BufferedImage): MessageReceipt = subject.sendImage(image) @JvmSynthetic - suspend inline fun sendImage(image: URL): MessageReceipt = subject.sendImage(image) + suspend fun sendImage(image: URL): MessageReceipt = subject.sendImage(image) @JvmSynthetic - suspend inline fun sendImage(image: Input): MessageReceipt = subject.sendImage(image) + suspend fun sendImage(image: Input): MessageReceipt = subject.sendImage(image) @JvmSynthetic - suspend inline fun sendImage(image: InputStream): MessageReceipt = subject.sendImage(image) + suspend fun sendImage(image: InputStream): MessageReceipt = subject.sendImage(image) @JvmSynthetic - suspend inline fun sendImage(image: File): MessageReceipt = subject.sendImage(image) + suspend fun sendImage(image: File): MessageReceipt = subject.sendImage(image) // endregion // region 上传图片 (扩展) @JvmSynthetic - suspend inline fun BufferedImage.upload(): Image = upload(subject) + suspend fun BufferedImage.upload(): Image = upload(subject) @JvmSynthetic - suspend inline fun URL.uploadAsImage(): Image = uploadAsImage(subject) + suspend fun URL.uploadAsImage(): Image = uploadAsImage(subject) @JvmSynthetic - suspend inline fun Input.uploadAsImage(): Image = uploadAsImage(subject) + suspend fun Input.uploadAsImage(): Image = uploadAsImage(subject) @JvmSynthetic - suspend inline fun InputStream.uploadAsImage(): Image = uploadAsImage(subject) + suspend fun InputStream.uploadAsImage(): Image = uploadAsImage(subject) @JvmSynthetic - suspend inline fun File.uploadAsImage(): Image = uploadAsImage(subject) + suspend fun File.uploadAsImage(): Image = uploadAsImage(subject) // endregion 上传图片 (扩展) // region 发送图片 (扩展) @JvmSynthetic - suspend inline fun BufferedImage.send(): MessageReceipt = sendTo(subject) + suspend fun BufferedImage.send(): MessageReceipt = sendTo(subject) @JvmSynthetic - suspend inline fun URL.sendAsImage(): MessageReceipt = sendAsImageTo(subject) + suspend fun URL.sendAsImage(): MessageReceipt = sendAsImageTo(subject) @JvmSynthetic - suspend inline fun Input.sendAsImage(): MessageReceipt = sendAsImageTo(subject) + suspend fun Input.sendAsImage(): MessageReceipt = sendAsImageTo(subject) @JvmSynthetic - suspend inline fun InputStream.sendAsImage(): MessageReceipt = sendAsImageTo(subject) + suspend fun InputStream.sendAsImage(): MessageReceipt = sendAsImageTo(subject) @JvmSynthetic - suspend inline fun File.sendAsImage(): MessageReceipt = sendAsImageTo(subject) + suspend fun File.sendAsImage(): MessageReceipt = sendAsImageTo(subject) // endregion 发送图片 (扩展) } \ No newline at end of file