KaScopeContext¶
@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
interface KaScopeContext : KaLifetimeOwner
A scope context includes all scopes that are relevant for a given KtElement position in a KtFile, together with all available implicit receivers.
See also¶
Properties¶
implicitReceivers¶
open val implicitReceivers: List<KaImplicitReceiver>
The implicit receivers available at the context position.
The list is sorted according to the order of scopes in the scope tower (from innermost to outermost).
It is possible to use this@ + KaImplicitReceiver.label to refer to the corresponding implicit receiver.
this (without any explicit label) can be used to explicitly refer to the (currently) implicit receiver with the lowest index in the scope tower (= innermost scope).
implicitValues¶
abstract val implicitValues: List<KaScopeImplicitValue>
The implicit values available at the context position.
The list is sorted according to the order of scopes in the scope tower (from innermost to outermost).
See also
possibleSmartCasts¶
abstract val possibleSmartCasts: List<KaSmartCastPossibility>
The list of smart casts available at the context position.
Note that an actual smart cast will only appear if the original expression type does not match the expected type. For actual smart cast application, check KaDataFlowProvider.smartCastInfo.
The list has an arbitrary (but stable) order.
scopes¶
abstract val scopes: List<KaScopeWithKind>
The KaScopes available at the context position. KaScopeWithKind additionally determines the kind of scope at the index in the scope tower.
The list is sorted according to the order of scopes in the scope tower (from innermost to outermost).
token¶
abstract val token: KaLifetimeToken
The KaLifetimeToken which determines the lifetime of the lifetime owner.
Functions¶
assertIsValidAndAccessible¶
inline fun KaLifetimeOwner.assertIsValidAndAccessible()
compositeScope¶
context(session: KaSession)
fun KaScopeContext.compositeScope(filter: (KaScopeKind) -> Boolean = { true }): KaScope
isValid¶
fun KaLifetimeOwner.isValid(): Boolean
Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.
withValidityAssertion¶
inline fun <R> KaLifetimeOwner.withValidityAssertion(action: () -> R): R
Executes action only if the KaLifetimeOwner is still valid and accessible. Otherwise, throws a validity exception based on the concrete violation.