Optimize visibility for controller field in CoroutineImpl
While it's impossible to declare a property with protected field and public getter we split these entities - `_controller` field is used inside coroutines - `controller` getter is used for accesing controller from noinline lambdas (also it can be used to obtain controller from continuation by explicit cast)
This commit is contained in:
@@ -17,10 +17,12 @@
|
||||
package kotlin.jvm.internal
|
||||
|
||||
abstract class CoroutineImpl(arity: Int) : Lambda(arity), Continuation<Any?> {
|
||||
@JvmField
|
||||
protected var _controller: Any? = null
|
||||
|
||||
// It's not protected because can be used from noinline lambdas inside coroutine (when calling non-suspend functions)
|
||||
// Also there might be needed a way to access a controller by Continuation instance when it's inherited from CoroutineImpl
|
||||
@JvmField
|
||||
var controller: Any? = null
|
||||
val controller: Any? get() = _controller
|
||||
|
||||
// Any label state less then zero indicates that coroutine is not run and can't be resumed in any way.
|
||||
// Specific values do not matter by now, but currently -2 used for uninitialized coroutine (no controller is assigned),
|
||||
|
||||
Reference in New Issue
Block a user