From 3b06df6bc5a7eabe806f8132cf37fa1ce77d58b9 Mon Sep 17 00:00:00 2001 From: Him188 <Him188@mamoe.net> Date: Wed, 3 Feb 2021 20:22:56 +0800 Subject: [PATCH] Simplify EventChannel.parentScope --- mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt b/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt index 333f0790e..8fc7c1cbc 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/EventChannel.kt @@ -266,11 +266,7 @@ public open class EventChannel<out BaseEvent : Event> @JvmOverloads internal con * @see CoroutineScope.globalEventChannel `GlobalEventChannel.parentScope()` 的扩展 */ public fun parentScope(coroutineScope: CoroutineScope): EventChannel<BaseEvent> { - return context(coroutineScope.coroutineContext).run { - val job = coroutineScope.coroutineContext[Job] - if (job != null) parentJob(job) - else this - } + return context(coroutineScope.coroutineContext) } /**