FIR2IR: remove code duplication from CallAndReferenceGenerator
This commit is contained in:
+1
-16
@@ -784,22 +784,7 @@ class CallAndReferenceGenerator(
|
|||||||
val argumentsCount = call.arguments.size
|
val argumentsCount = call.arguments.size
|
||||||
if (argumentsCount <= valueArgumentsCount) {
|
if (argumentsCount <= valueArgumentsCount) {
|
||||||
apply {
|
apply {
|
||||||
val calleeReference = when (call) {
|
val (valueParameters, argumentMapping, substitutor) = extractArgumentsMapping(call)
|
||||||
is FirFunctionCall -> call.calleeReference
|
|
||||||
is FirDelegatedConstructorCall -> call.calleeReference
|
|
||||||
is FirAnnotationCall -> call.calleeReference
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
val function = if (calleeReference == FirReferencePlaceholderForResolvedAnnotations) {
|
|
||||||
val coneClassLikeType = (call as FirAnnotation).annotationTypeRef.coneTypeSafe<ConeClassLikeType>()
|
|
||||||
val firClass = (coneClassLikeType?.lookupTag?.toSymbol(session) as? FirRegularClassSymbol)?.fir
|
|
||||||
firClass?.declarations?.filterIsInstance<FirConstructor>()?.firstOrNull()
|
|
||||||
} else {
|
|
||||||
((calleeReference as? FirResolvedNamedReference)?.resolvedSymbol as? FirFunctionSymbol<*>)?.fir
|
|
||||||
}
|
|
||||||
val valueParameters = function?.valueParameters
|
|
||||||
val argumentMapping = call.resolvedArgumentMapping
|
|
||||||
val substitutor = (call as? FirFunctionCall)?.buildSubstitutorByCalledFunction(function) ?: ConeSubstitutor.Empty
|
|
||||||
if (argumentMapping != null && (annotationMode || argumentMapping.isNotEmpty())) {
|
if (argumentMapping != null && (annotationMode || argumentMapping.isNotEmpty())) {
|
||||||
if (valueParameters != null) {
|
if (valueParameters != null) {
|
||||||
return applyArgumentsWithReorderingIfNeeded(
|
return applyArgumentsWithReorderingIfNeeded(
|
||||||
|
|||||||
Reference in New Issue
Block a user