[FIR] Get rid of the argumentMapping function.
It's just a duplicate of `resolvedArgumentMapping`. Plus there is a member with the same name inside `FirAnnotationCall`.
This commit is contained in:
+2
-2
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirFunctionCallChec
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors
|
||||
import org.jetbrains.kotlin.fir.declarations.isJavaOrEnhancement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.argumentMapping
|
||||
import org.jetbrains.kotlin.fir.expressions.resolvedArgumentMapping
|
||||
import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol
|
||||
import org.jetbrains.kotlin.fir.originalOrSelf
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
|
||||
@@ -51,7 +51,7 @@ object FirJavaGenericVarianceViolationTypeChecker : FirFunctionCallChecker() {
|
||||
if (!calleeFunction.originalOrSelf().isJavaOrEnhancement) {
|
||||
return
|
||||
}
|
||||
val argumentMapping = expression.argumentMapping ?: return
|
||||
val argumentMapping = expression.resolvedArgumentMapping ?: return
|
||||
val typeArgumentMap = mutableMapOf<FirTypeParameterSymbol, ConeKotlinType>()
|
||||
for (i in 0 until expression.typeArguments.size) {
|
||||
val type = (expression.typeArguments[i] as? FirTypeProjectionWithVariance)?.typeRef?.coneType
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ object FirNamedVarargChecker : FirCallChecker() {
|
||||
// FirArrayOfCall has the `vararg` argument expression pre-flattened and doesn't have an argument mapping.
|
||||
expression.arguments.forEach { checkArgument(it, it is FirNamedArgumentExpression, null /* not used for annotation call */) }
|
||||
} else {
|
||||
val argumentMap = expression.argumentMapping ?: return
|
||||
val argumentMap = expression.resolvedArgumentMapping ?: return
|
||||
for ((argument, parameter) in argumentMap) {
|
||||
if (!parameter.isVararg) continue
|
||||
if (argument is FirVarargArgumentsExpression) {
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ internal object FirToConstantValueTransformer : FirDefaultVisitor<ConstantValue<
|
||||
AnnotationValue(
|
||||
buildAnnotationCall {
|
||||
argumentMapping = buildAnnotationArgumentMapping {
|
||||
constructorCall.argumentMapping?.forEach { (firExpression, firValueParameter) ->
|
||||
constructorCall.resolvedArgumentMapping?.forEach { (firExpression, firValueParameter) ->
|
||||
mapping[firValueParameter.name] = firExpression
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ fun createArgumentsMapping(qualifiedAccess: FirQualifiedAccess): Map<Int, FirExp
|
||||
is FirFunctionCall -> {
|
||||
val function = qualifiedAccess.toResolvedCallableSymbol()?.fir as? FirSimpleFunction ?: return null
|
||||
val parameterToIndex = function.valueParameters.mapIndexed { index, parameter -> parameter to index }.toMap()
|
||||
val callArgumentMapping = qualifiedAccess.argumentMapping ?: return null
|
||||
val callArgumentMapping = qualifiedAccess.resolvedArgumentMapping ?: return null
|
||||
for (argument in qualifiedAccess.arguments) {
|
||||
argumentsMapping[parameterToIndex.getValue(callArgumentMapping.getValue(argument))] = argument.unwrapArgument()
|
||||
}
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
// var someProperty: SomeType
|
||||
// get() = delegate.getValue(thisRef, kProperty: KProperty0/1/2<..., SomeType>)
|
||||
// set() = delegate.getValue(thisRef, kProperty: KProperty0/1/2<..., SomeType>, value)
|
||||
val propertyReferenceAccess = argumentMapping?.keys?.toList()?.getOrNull(1) as? FirCallableReferenceAccess ?: return
|
||||
val propertyReferenceAccess = resolvedArgumentMapping?.keys?.toList()?.getOrNull(1) as? FirCallableReferenceAccess ?: return
|
||||
val typeRef = propertyReferenceAccess.typeRef
|
||||
if (typeRef is FirResolvedTypeRef && property.returnTypeRef is FirResolvedTypeRef) {
|
||||
val typeArguments = (typeRef.type as ConeClassLikeType).typeArguments
|
||||
|
||||
@@ -57,13 +57,7 @@ inline val FirCall.dynamicVarargArguments: List<FirExpression>?
|
||||
inline val FirFunctionCall.isCalleeDynamic: Boolean
|
||||
get() = (calleeReference.resolvedSymbol?.fir as? FirFunction)?.origin == FirDeclarationOrigin.DynamicScope
|
||||
|
||||
inline val FirCall.resolvedArgumentMapping: Map<FirExpression, FirValueParameter>?
|
||||
get() = when (val argumentList = argumentList) {
|
||||
is FirResolvedArgumentList -> argumentList.mapping
|
||||
else -> null
|
||||
}
|
||||
|
||||
inline val FirCall.argumentMapping: LinkedHashMap<FirExpression, FirValueParameter>?
|
||||
inline val FirCall.resolvedArgumentMapping: LinkedHashMap<FirExpression, FirValueParameter>?
|
||||
get() = when (val argumentList = argumentList) {
|
||||
is FirResolvedArgumentList -> argumentList.mapping
|
||||
else -> null
|
||||
|
||||
Reference in New Issue
Block a user