KaFunctionCall¶
@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
interface KaFunctionCall<S : KaFunctionSymbol> : KaSimpleCall<S, KaFunctionSignature<S>> , KaCallableMemberCall<S, KaFunctionSignature<S>>
A call to a function within Kotlin code. This includes calls to regular functions, constructors, constructors of superclasses, and annotations.
Inheritors¶
Properties¶
calls¶
val KaCallInfo.calls: List<KaCall>
The list of KaCalls associated with the KaCallInfo. The list contains a single KaCall in case of a successful call, but may contain multiple candidates in case of an error call.
The flattened list of resolved calls.
-
KaSimpleCallResolutionSuccess: the resolvedcallas a single-element list. -
KaMultiCallResolutionAttempt: the assembledcallif all sub-calls succeeded, or the combined calls from individualsimpleAttemptsotherwise.
val KaSimpleOrMultiCall.calls: List<KaSimpleCall<*, *>>
The flattened list of KaSimpleCalls.
-
If
thisis an instance ofKaSimpleCall, the list will contain onlythiscall -
If
thisis an instance ofKaMultiCall, the list will containKaMultiCall.calls
combinedArgumentMapping¶
abstract val combinedArgumentMapping: Map<KtExpression, KaVariableSignature<KaParameterSymbol>>
A combined mapping from the call's argument expressions to their associated parameter symbols in a stable order. This includes both value arguments and context arguments.
In case of vararg parameters, multiple arguments may be mapped to the same KaValueParameterSymbol.
See also
constructor¶
this call as a call to a constructor, or null if it is not a constructor call.
Example
Both the Foo() call and the @Anno annotation entry are constructor calls, so constructor returns the call itself.
See also
contextArgumentMapping¶
abstract val contextArgumentMapping: Map<KtExpression, KaVariableSignature<KaContextParameterSymbol>>
A mapping from the call's explicit context argument expressions to their associated context parameter symbols in a stable order.
Example
context(a: A, b: B)
fun foo() { ... }
fun test() {
with(A()) {
foo(b = B()) // explicit context argument `b = B()`
}
}
For the foo(b = B()) call, contextArgumentMapping contains a single entry mapping the B() expression to the context parameter b: B.
See also
contextArguments¶
abstract val contextArguments: List<KaReceiverValue>
The list of context parameters for this symbol access. The list is available if the callable is declared with context parameters.
dispatchReceiver¶
abstract val dispatchReceiver: KaReceiverValue?
The dispatch receiver for this symbol access. A dispatch receiver is available if the callable is declared inside a class or object.
extensionReceiver¶
abstract val extensionReceiver: KaReceiverValue?
The extension receiver for this symbol access. An extension receiver is available if the callable is declared with an extension receiver.
function¶
val KaSimpleOrMultiCall.function: KaFunctionCall<*>?
this call as a KaFunctionCall, or null if it is not a call to a function.
Example
For function(), function is the call to function. For int, which is a KaVariableAccessCall, function is null.
See also
signature¶
simple¶
val KaSimpleOrMultiCall.simple: KaSimpleCall<*, *>?
this call as a KaSimpleCall, or null if it is a KaMultiCall.
Example
For int = 2, simple is the write access to int. For int++, which is a KaMultiCall, simple is null.
See also
symbol¶
val <S : KaCallableSymbol, C : KaCallableSignature<S>> KaCallableMemberCall<S, C>.symbol: S
The KaCallableSymbol of the KaCallableMemberCall's callee.
val <S : KaCallableSymbol, C : KaCallableSignature<S>> KaSimpleCall<S, C>.symbol: S
The resolved KaCallableSymbol of the KaSimpleCall.
This is a short-cut for KaCallableSignature.symbol.
val <S : KaCallableSymbol, C : KaCallableSignature<S>> KaPartiallyAppliedSymbol<S, C>.symbol: S
The callable symbol which the KaPartiallyAppliedSymbol represents. While the information contained in a partially applied symbol is not exhaustive (e.g. applied functions are missing value arguments), the symbol of the callable which is called is definite.
symbols¶
The flattened list of KaSymbols for the resolved calls.
-
If
thisis an instance ofKaSimpleCall, the list will contain only theKaSimpleCall.signature's symbol -
If
thisis an instance ofKaMultiCall, the list will contain symbols from allKaMultiCall.calls
A list of KaSymbol.
-
If
thisis an instance ofKaSimpleSymbolResolutionSuccess, the list will containKaSimpleSymbolResolutionSuccess.symbols. -
If
thisis an instance ofKaSimpleSymbolResolutionError, the list will containKaSimpleSymbolResolutionError.candidateSymbols. -
If
thisis an instance ofKaCompoundSymbolResolutionError, the list will contain the combined symbols from all attempts.
See also
token¶
abstract val token: KaLifetimeToken
The KaLifetimeToken which determines the lifetime of the lifetime owner.
typeArgumentsMapping¶
abstract val typeArgumentsMapping: Map<KaTypeParameterSymbol, KaType>
A map of inferred type arguments. If type placeholders were used, the actual inferred type will be used as a value. The keys for this map are from signature's type parameters.
In case of a resolution or inference error, the map might be empty.
valueArgumentMapping¶
abstract val valueArgumentMapping: Map<KtExpression, KaVariableSignature<KaValueParameterSymbol>>
A mapping from the call's argument expressions to their associated parameter symbols in a stable order. In case of vararg parameters, multiple arguments may be mapped to the same KaValueParameterSymbol.
See also
variable¶
this call as a KaVariableAccessCall, or null if it is not an access to a variable.
Example
For int, variable is the read access to int. For function(), which is a KaFunctionCall, variable is null.
See also
Functions¶
assertIsValidAndAccessible¶
inline fun KaLifetimeOwner.assertIsValidAndAccessible()
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.