[AA] KtAnnotated: split hasAnnotation to two extensions
This commit is contained in:
committed by
Space Team
parent
2c305b46df
commit
5a74fec3ac
+9
-2
@@ -33,10 +33,17 @@ internal class KtFirAnnotationListForDeclaration private constructor(
|
||||
override fun hasAnnotation(
|
||||
classId: ClassId,
|
||||
useSiteTarget: AnnotationUseSiteTarget?,
|
||||
strictUseSite: Boolean,
|
||||
acceptAnnotationsWithoutUseSite: Boolean,
|
||||
): Boolean = withValidityAssertion {
|
||||
firSymbol.resolvedAnnotationsWithClassIds.any {
|
||||
(it.useSiteTarget == useSiteTarget || !strictUseSite && it.useSiteTarget == null) && it.fullyExpandedClassId(useSiteSession) == classId
|
||||
(it.useSiteTarget == useSiteTarget || acceptAnnotationsWithoutUseSite && it.useSiteTarget == null) &&
|
||||
it.fullyExpandedClassId(useSiteSession) == classId
|
||||
}
|
||||
}
|
||||
|
||||
override fun hasAnnotation(classId: ClassId): Boolean = withValidityAssertion {
|
||||
firSymbol.resolvedAnnotationsWithClassIds.any {
|
||||
it.fullyExpandedClassId(useSiteSession) == classId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -38,10 +38,17 @@ internal class KtFirAnnotationListForReceiverParameter private constructor(
|
||||
override fun hasAnnotation(
|
||||
classId: ClassId,
|
||||
useSiteTarget: AnnotationUseSiteTarget?,
|
||||
strictUseSite: Boolean,
|
||||
acceptAnnotationsWithoutUseSite: Boolean,
|
||||
): Boolean = withValidityAssertion {
|
||||
receiverParameter.resolvedAnnotationsWithClassIds(firCallableSymbol).any {
|
||||
(it.useSiteTarget == useSiteTarget || !strictUseSite && it.useSiteTarget == null) && it.fullyExpandedClassId(useSiteSession) == classId
|
||||
(it.useSiteTarget == useSiteTarget || acceptAnnotationsWithoutUseSite && it.useSiteTarget == null) &&
|
||||
it.fullyExpandedClassId(useSiteSession) == classId
|
||||
}
|
||||
}
|
||||
|
||||
override fun hasAnnotation(classId: ClassId): Boolean = withValidityAssertion {
|
||||
receiverParameter.resolvedAnnotationsWithClassIds(firCallableSymbol).any {
|
||||
it.fullyExpandedClassId(useSiteSession) == classId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -29,10 +29,17 @@ internal class KtFirAnnotationListForType private constructor(
|
||||
override fun hasAnnotation(
|
||||
classId: ClassId,
|
||||
useSiteTarget: AnnotationUseSiteTarget?,
|
||||
strictUseSite: Boolean,
|
||||
acceptAnnotationsWithoutUseSite: Boolean,
|
||||
): Boolean = withValidityAssertion {
|
||||
coneType.customAnnotations.any {
|
||||
(it.useSiteTarget == useSiteTarget || !strictUseSite && it.useSiteTarget == null) && it.fullyExpandedClassId(useSiteSession) == classId
|
||||
(it.useSiteTarget == useSiteTarget || acceptAnnotationsWithoutUseSite && it.useSiteTarget == null) &&
|
||||
it.fullyExpandedClassId(useSiteSession) == classId
|
||||
}
|
||||
}
|
||||
|
||||
override fun hasAnnotation(classId: ClassId): Boolean = withValidityAssertion {
|
||||
coneType.customAnnotations.any {
|
||||
it.fullyExpandedClassId(useSiteSession) == classId
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user