FIR IDE: Remove KtCallWithArguments and move arguments up to KtCall.
This commit is contained in:
committed by
Ilya Kirillov
parent
7f9ed58c7d
commit
f7dd6a0f64
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.psi.KtValueArgument
|
||||
*/
|
||||
public sealed class KtCall {
|
||||
public abstract val isErrorCall: Boolean
|
||||
public abstract val argumentMapping: LinkedHashMap<KtValueArgument, KtValueParameterSymbol>
|
||||
public abstract val targetFunction: KtCallTarget
|
||||
}
|
||||
|
||||
@@ -28,6 +29,7 @@ public sealed class KtCall {
|
||||
*/
|
||||
public class KtFunctionalTypeVariableCall(
|
||||
public val target: KtVariableLikeSymbol,
|
||||
override val argumentMapping: LinkedHashMap<KtValueArgument, KtValueParameterSymbol>,
|
||||
override val targetFunction: KtCallTarget
|
||||
) : KtCall() {
|
||||
override val isErrorCall: Boolean get() = false
|
||||
@@ -52,16 +54,10 @@ public sealed class KtDeclaredFunctionCall : KtCall() {
|
||||
*/
|
||||
public class KtVariableWithInvokeFunctionCall(
|
||||
public val target: KtVariableLikeSymbol,
|
||||
override val argumentMapping: LinkedHashMap<KtValueArgument, KtValueParameterSymbol>,
|
||||
override val targetFunction: KtCallTarget
|
||||
) : KtDeclaredFunctionCall()
|
||||
|
||||
/**
|
||||
* Represents a direct function call with arguments
|
||||
*/
|
||||
public sealed class KtCallWithArguments : KtDeclaredFunctionCall() {
|
||||
public abstract val argumentMapping: LinkedHashMap<KtValueArgument, KtValueParameterSymbol>
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple function call, e.g.,
|
||||
*
|
||||
@@ -70,7 +66,7 @@ public sealed class KtCallWithArguments : KtDeclaredFunctionCall() {
|
||||
public class KtFunctionCall(
|
||||
override val argumentMapping: LinkedHashMap<KtValueArgument, KtValueParameterSymbol>,
|
||||
override val targetFunction: KtCallTarget
|
||||
) : KtCallWithArguments()
|
||||
) : KtDeclaredFunctionCall()
|
||||
|
||||
/**
|
||||
* Annotation call, e.g.,
|
||||
@@ -81,7 +77,7 @@ public class KtFunctionCall(
|
||||
public class KtAnnotationCall(
|
||||
override val argumentMapping: LinkedHashMap<KtValueArgument, KtValueParameterSymbol>,
|
||||
override val targetFunction: KtCallTarget
|
||||
) : KtCallWithArguments()
|
||||
) : KtDeclaredFunctionCall()
|
||||
// TODO: Add other properties, e.g., useSiteTarget
|
||||
|
||||
/**
|
||||
@@ -96,7 +92,7 @@ public class KtDelegatedConstructorCall(
|
||||
override val argumentMapping: LinkedHashMap<KtValueArgument, KtValueParameterSymbol>,
|
||||
override val targetFunction: KtCallTarget,
|
||||
public val kind: KtDelegatedConstructorCallKind
|
||||
) : KtCallWithArguments()
|
||||
) : KtDeclaredFunctionCall()
|
||||
|
||||
public enum class KtDelegatedConstructorCallKind { SUPER_CALL, THIS_CALL }
|
||||
|
||||
|
||||
+3
-2
@@ -111,14 +111,15 @@ internal class KtFirCallResolver(
|
||||
(callReference.resolvedSymbol.fir.buildSymbol(firSymbolBuilder) as? KtFunctionSymbol)
|
||||
?.let {
|
||||
if (callableId in kotlinFunctionInvokeCallableIds) {
|
||||
KtFunctionalTypeVariableCall(variableLikeSymbol, KtSuccessCallTarget(it))
|
||||
KtFunctionalTypeVariableCall(variableLikeSymbol, createArgumentMapping(), KtSuccessCallTarget(it))
|
||||
} else {
|
||||
KtVariableWithInvokeFunctionCall(variableLikeSymbol, KtSuccessCallTarget(it))
|
||||
KtVariableWithInvokeFunctionCall(variableLikeSymbol, createArgumentMapping(), KtSuccessCallTarget(it))
|
||||
}
|
||||
}
|
||||
}
|
||||
is FirErrorNamedReference -> KtVariableWithInvokeFunctionCall(
|
||||
variableLikeSymbol,
|
||||
createArgumentMapping(),
|
||||
callReference.createErrorCallTarget(source)
|
||||
)
|
||||
else -> error("Unexpected call reference ${callReference::class.simpleName}")
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
KtFunctionalTypeVariableCall:
|
||||
target = x: kotlin.Function1<kotlin.Int, kotlin.String>
|
||||
argumentMapping = { 1 -> (p1: kotlin.Int) }
|
||||
targetFunction = kotlin/Function1.invoke(p1: kotlin.Int): kotlin.String
|
||||
Reference in New Issue
Block a user