kotlinx-coroutines-core/common/src/selects/SelectOld.kt [36:55]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (cont.isCompleted) return cont.getResult() CoroutineScope(context).launch(start = CoroutineStart.UNDISPATCHED) { val result = try { doSelect() } catch (e: Throwable) { cont.resumeUndispatchedWithException(e) return@launch } cont.resumeUndispatched(result) } return cont.getResult() } @PublishedApi internal fun handleBuilderException(e: Throwable) { cont.resumeWithException(e) // will be thrown later via `cont.getResult()` } } @PublishedApi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - kotlinx-coroutines-core/common/src/selects/SelectOld.kt [64:99]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (cont.isCompleted) return cont.getResult() CoroutineScope(context).launch(start = CoroutineStart.UNDISPATCHED) { val result = try { doSelect() } catch (e: Throwable) { cont.resumeUndispatchedWithException(e) return@launch } cont.resumeUndispatched(result) } return cont.getResult() } @PublishedApi internal fun handleBuilderException(e: Throwable) { cont.resumeWithException(e) } } /* * This is the old version of `select`. It should work to guarantee binary compatibility. * * Internal note: * We do test it manually by changing the implementation of **new** select with the following: * ``` * public suspend inline fun select(crossinline builder: SelectBuilder.() -> Unit): R { * contract { * callsInPlace(builder, InvocationKind.EXACTLY_ONCE) * } * return selectOld(builder) * } * ``` * * These signatures are not used by the already compiled code, but their body is. */ @PublishedApi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -