[FIR] Rename UnderAnnotatedWith predicate to AncestorAnnotatedWith

This commit is contained in:
Dmitriy Novozhilov
2022-06-02 14:45:25 +03:00
committed by teamcity
parent 66c2679673
commit a85d25d7a6
4 changed files with 25 additions and 25 deletions
@@ -119,15 +119,15 @@ internal class LLFirIdePredicateBasedProvider(
return annotationsOnDeclaration(data).any { it in predicate.annotations }
}
override fun visitUnderAnnotatedWith(predicate: UnderAnnotatedWith, data: FirDeclaration): Boolean {
override fun visitAncestorAnnotatedWith(predicate: AncestorAnnotatedWith, data: FirDeclaration): Boolean {
return annotationsOnOuterDeclarations(data).any { it in predicate.annotations }
}
override fun visitAnnotatedWithMeta(predicate: AnnotatedWithMeta, data: FirDeclaration): Boolean {
override fun visitMetaAnnotatedWith(predicate: MetaAnnotatedWith, data: FirDeclaration): Boolean {
return metaAnnotationsOnDeclaration(data).any { it in predicate.metaAnnotations }
}
override fun visitUnderMetaAnnotated(predicate: UnderMetaAnnotated, data: FirDeclaration): Boolean {
override fun visitAncestorMetaAnnotatedWith(predicate: AncestorMetaAnnotatedWith, data: FirDeclaration): Boolean {
return metaAnnotationsOnOuterDeclarations(data).any { it in predicate.metaAnnotations }
}
}
@@ -101,7 +101,7 @@ class FirPredicateBasedProviderImpl(private val session: FirSession) : FirPredic
return matchWith(data, predicate.annotations)
}
override fun visitUnderAnnotatedWith(predicate: UnderAnnotatedWith, data: FirDeclaration): Boolean {
override fun visitAncestorAnnotatedWith(predicate: AncestorAnnotatedWith, data: FirDeclaration): Boolean {
return matchUnder(data, predicate.annotations)
}
@@ -115,11 +115,11 @@ class FirPredicateBasedProviderImpl(private val session: FirSession) : FirPredic
// ------------------------------------ Meta Annotated ------------------------------------
override fun visitAnnotatedWithMeta(predicate: AnnotatedWithMeta, data: FirDeclaration): Boolean {
override fun visitMetaAnnotatedWith(predicate: MetaAnnotatedWith, data: FirDeclaration): Boolean {
return matchWith(data, predicate.userDefinedAnnotations)
}
override fun visitUnderMetaAnnotated(predicate: UnderMetaAnnotated, data: FirDeclaration): Boolean {
override fun visitAncestorMetaAnnotatedWith(predicate: AncestorMetaAnnotatedWith, data: FirDeclaration): Boolean {
return matchUnder(data, predicate.userDefinedAnnotations)
}
@@ -100,9 +100,9 @@ class AnnotatedWith(annotations: Set<AnnotationFqn>) : Annotated(annotations) {
*
* Matched symbols: [fun A.baz, class Nested, fun Nested.foobar]
*/
class UnderAnnotatedWith(annotations: Set<AnnotationFqn>) : Annotated(annotations) {
class AncestorAnnotatedWith(annotations: Set<AnnotationFqn>) : Annotated(annotations) {
override fun <R, D> accept(visitor: DeclarationPredicateVisitor<R, D>, data: D): R {
return visitor.visitUnderAnnotatedWith(this, data)
return visitor.visitAncestorAnnotatedWith(this, data)
}
}
@@ -174,15 +174,15 @@ sealed class MetaAnnotated(final override val metaAnnotations: Set<AnnotationFqn
}
}
class AnnotatedWithMeta(metaAnnotations: Set<AnnotationFqn>) : MetaAnnotated(metaAnnotations) {
class MetaAnnotatedWith(metaAnnotations: Set<AnnotationFqn>) : MetaAnnotated(metaAnnotations) {
override fun <R, D> accept(visitor: DeclarationPredicateVisitor<R, D>, data: D): R {
return visitor.visitAnnotatedWithMeta(this, data)
return visitor.visitMetaAnnotatedWith(this, data)
}
}
class UnderMetaAnnotated(metaAnnotations: Set<AnnotationFqn>) : MetaAnnotated(metaAnnotations) {
class AncestorMetaAnnotatedWith(metaAnnotations: Set<AnnotationFqn>) : MetaAnnotated(metaAnnotations) {
override fun <R, D> accept(visitor: DeclarationPredicateVisitor<R, D>, data: D): R {
return visitor.visitUnderMetaAnnotated(this, data)
return visitor.visitAncestorMetaAnnotatedWith(this, data)
}
}
@@ -204,31 +204,31 @@ infix fun DeclarationPredicate.or(other: DeclarationPredicate): DeclarationPredi
infix fun DeclarationPredicate.and(other: DeclarationPredicate): DeclarationPredicate = DeclarationPredicate.And(this, other)
// ------------------- varargs -------------------
fun under(vararg annotations: AnnotationFqn): DeclarationPredicate = UnderAnnotatedWith(annotations.toSet())
fun annotated(vararg annotations: AnnotationFqn): DeclarationPredicate = AnnotatedWith(annotations.toSet())
fun ancestorAnnotated(vararg annotations: AnnotationFqn): DeclarationPredicate = AncestorAnnotatedWith(annotations.toSet())
fun parentAnnotated(vararg annotations: AnnotationFqn): DeclarationPredicate = ParentAnnotatedWith(annotations.toSet())
fun hasAnnotated(vararg annotations: AnnotationFqn): DeclarationPredicate = HasAnnotatedWith(annotations.toSet())
fun metaUnder(vararg metaAnnotations: AnnotationFqn): DeclarationPredicate = UnderMetaAnnotated(metaAnnotations.toSet())
fun metaAnnotated(vararg metaAnnotations: AnnotationFqn): DeclarationPredicate = AnnotatedWithMeta(metaAnnotations.toSet())
fun metaAnnotated(vararg metaAnnotations: AnnotationFqn): DeclarationPredicate = MetaAnnotatedWith(metaAnnotations.toSet())
fun metaAncestorAnnotated(vararg metaAnnotations: AnnotationFqn): DeclarationPredicate = AncestorMetaAnnotatedWith(metaAnnotations.toSet())
fun parentMetaAnnotated(vararg metaAnnotations: AnnotationFqn): DeclarationPredicate = ParentMetaAnnotatedWith(metaAnnotations.toSet())
fun hasMetaAnnotated(vararg metaAnnotations: AnnotationFqn): DeclarationPredicate = HasMetaAnnotatedWith(metaAnnotations.toSet())
fun annotatedOrUnder(vararg annotations: AnnotationFqn): DeclarationPredicate = annotated(*annotations) or under(*annotations)
fun annotatedOrUnder(vararg annotations: AnnotationFqn): DeclarationPredicate = annotated(*annotations) or ancestorAnnotated(*annotations)
fun metaAnnotatedOrUnder(vararg metaAnnotations: AnnotationFqn): DeclarationPredicate =
metaAnnotated(*metaAnnotations) or metaUnder(*metaAnnotations)
metaAnnotated(*metaAnnotations) or metaAncestorAnnotated(*metaAnnotations)
// ------------------- collections -------------------
fun under(annotations: Collection<AnnotationFqn>): DeclarationPredicate = UnderAnnotatedWith(annotations.toSet())
fun annotated(annotations: Collection<AnnotationFqn>): DeclarationPredicate = AnnotatedWith(annotations.toSet())
fun ancestorAnnotated(annotations: Collection<AnnotationFqn>): DeclarationPredicate = AncestorAnnotatedWith(annotations.toSet())
fun parentAnnotated(annotations: Collection<AnnotationFqn>): DeclarationPredicate = ParentAnnotatedWith(annotations.toSet())
fun hasAnnotated(annotations: Collection<AnnotationFqn>): DeclarationPredicate = HasAnnotatedWith(annotations.toSet())
fun metaUnder(metaAnnotations: Collection<AnnotationFqn>): DeclarationPredicate = UnderMetaAnnotated(metaAnnotations.toSet())
fun metaAnnotated(metaAnnotations: Collection<AnnotationFqn>): DeclarationPredicate = AnnotatedWithMeta(metaAnnotations.toSet())
fun metaAnnotated(metaAnnotations: Collection<AnnotationFqn>): DeclarationPredicate = MetaAnnotatedWith(metaAnnotations.toSet())
fun metaAncestorAnnotated(metaAnnotations: Collection<AnnotationFqn>): DeclarationPredicate = AncestorMetaAnnotatedWith(metaAnnotations.toSet())
fun parentMetaAnnotated(metaAnnotations: Collection<AnnotationFqn>): DeclarationPredicate = ParentMetaAnnotatedWith(metaAnnotations.toSet())
fun hasMetaAnnotated(metaAnnotations: Collection<AnnotationFqn>): DeclarationPredicate = HasMetaAnnotatedWith(metaAnnotations.toSet())
fun annotatedOrUnder(annotations: Collection<AnnotationFqn>): DeclarationPredicate = annotated(annotations) or under(annotations)
fun annotatedOrUnder(annotations: Collection<AnnotationFqn>): DeclarationPredicate = annotated(annotations) or ancestorAnnotated(annotations)
fun metaAnnotatedOrUnder(metaAnnotations: Collection<AnnotationFqn>): DeclarationPredicate =
metaAnnotated(metaAnnotations) or metaUnder(metaAnnotations)
metaAnnotated(metaAnnotations) or metaAncestorAnnotated(metaAnnotations)
@@ -24,7 +24,7 @@ abstract class DeclarationPredicateVisitor<R, D> {
return visitAnnotated(predicate, data)
}
open fun visitUnderAnnotatedWith(predicate: UnderAnnotatedWith, data: D): R {
open fun visitAncestorAnnotatedWith(predicate: AncestorAnnotatedWith, data: D): R {
return visitAnnotated(predicate, data)
}
@@ -40,11 +40,11 @@ abstract class DeclarationPredicateVisitor<R, D> {
return visitPredicate(predicate, data)
}
open fun visitAnnotatedWithMeta(predicate: AnnotatedWithMeta, data: D): R {
open fun visitMetaAnnotatedWith(predicate: MetaAnnotatedWith, data: D): R {
return visitMetaAnnotated(predicate, data)
}
open fun visitUnderMetaAnnotated(predicate: UnderMetaAnnotated, data: D): R {
open fun visitAncestorMetaAnnotatedWith(predicate: AncestorMetaAnnotatedWith, data: D): R {
return visitMetaAnnotated(predicate, data)
}