FIR: create argument mapping for annotation call in general
This commit is contained in:
committed by
Mikhail Glukhikh
parent
1a861b2df9
commit
4e6bd33eca
@@ -464,6 +464,10 @@ private fun FirQualifiedAccess.expressionTypeOrUnitForAssignment(): ConeKotlinTy
|
|||||||
|
|
||||||
fun FirAnnotationCall.getCorrespondingConstructorReferenceOrNull(session: FirSession): FirResolvedNamedReference? =
|
fun FirAnnotationCall.getCorrespondingConstructorReferenceOrNull(session: FirSession): FirResolvedNamedReference? =
|
||||||
annotationTypeRef.coneType.classId?.let {
|
annotationTypeRef.coneType.classId?.let {
|
||||||
|
if (it.isLocal) {
|
||||||
|
// TODO: How to retrieve local annotaiton's constructor?
|
||||||
|
null
|
||||||
|
} else {
|
||||||
(session.firSymbolProvider.getClassLikeSymbolByFqName(it) as? FirRegularClassSymbol)?.fir
|
(session.firSymbolProvider.getClassLikeSymbolByFqName(it) as? FirRegularClassSymbol)?.fir
|
||||||
?.getPrimaryConstructorIfAny()
|
?.getPrimaryConstructorIfAny()
|
||||||
?.let { annotationConstructor ->
|
?.let { annotationConstructor ->
|
||||||
@@ -474,3 +478,4 @@ fun FirAnnotationCall.getCorrespondingConstructorReferenceOrNull(session: FirSes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
-2
@@ -691,14 +691,12 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
|||||||
(annotationCall.transformChildren(transformer, data) as FirAnnotationCall).also {
|
(annotationCall.transformChildren(transformer, data) as FirAnnotationCall).also {
|
||||||
// TODO: it's temporary incorrect solution until we design resolve and completion for annotation calls
|
// TODO: it's temporary incorrect solution until we design resolve and completion for annotation calls
|
||||||
it.argumentList.transformArguments(integerLiteralTypeApproximator, null)
|
it.argumentList.transformArguments(integerLiteralTypeApproximator, null)
|
||||||
if (it.arguments.any { arg -> arg is FirNamedArgumentExpression }) {
|
|
||||||
annotationCall.getCorrespondingConstructorReferenceOrNull(session)?.let { calleeReference ->
|
annotationCall.getCorrespondingConstructorReferenceOrNull(session)?.let { calleeReference ->
|
||||||
val argumentMapping =
|
val argumentMapping =
|
||||||
mapArguments(it.arguments, calleeReference.resolvedSymbol.fir as FirFunction<*>)
|
mapArguments(it.arguments, calleeReference.resolvedSymbol.fir as FirFunction<*>)
|
||||||
.toArgumentToParameterMapping()
|
.toArgumentToParameterMapping()
|
||||||
it.replaceArgumentList(buildResolvedArgumentList(argumentMapping))
|
it.replaceArgumentList(buildResolvedArgumentList(argumentMapping))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
it.replaceResolveStatus(status)
|
it.replaceResolveStatus(status)
|
||||||
dataFlowAnalyzer.exitAnnotationCall(it)
|
dataFlowAnalyzer.exitAnnotationCall(it)
|
||||||
}.compose()
|
}.compose()
|
||||||
|
|||||||
Reference in New Issue
Block a user