Skip to content

KaScopeLike

Properties

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

Functions

assertIsValidAndAccessible

getAllPossibleNames

open fun getAllPossibleNames(): Set<Name>

Returns the set of top-level declaration names contained in the scope. The set may contain false positives, i.e. names which aren't contained in the scope.

getPossibleCallableNames

abstract fun getPossibleCallableNames(): Set<Name>

Returns the set of top-level callable names contained in the scope. The set may contain false positives, i.e. names which aren't contained in the scope.

getPossibleClassifierNames

abstract fun getPossibleClassifierNames(): Set<Name>

Returns the set of top-level classifier names contained in the scope. The set may contain false positives, i.e. names which aren't contained in the scope.

isValid

Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.

mayContainName

open fun mayContainName(name: Name): Boolean

Checks whether the scope might contain the given name.

Since getPossibleCallableNames and getPossibleClassifierNames admit false positives, the result may be true even if the scope doesn't contain a declaration with such a name. The reverse is not so: when mayContainName is false, the scope definitely doesn't contain a declaration with that name.

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.