From a85d25d7a67de4bd758507b4e512d24310093014 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 2 Jun 2022 14:45:25 +0300 Subject: [PATCH] [FIR] Rename UnderAnnotatedWith predicate to AncestorAnnotatedWith --- .../LLFirIdePredicateBasedProvider.kt | 6 ++-- .../FirPredicateBasedProviderImpl.kt | 6 ++-- .../predicate/DeclarationPredicate.kt | 32 +++++++++---------- .../predicate/DeclarationPredicateVisitor.kt | 6 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirIdePredicateBasedProvider.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirIdePredicateBasedProvider.kt index 53708da74fd..e482b25330c 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirIdePredicateBasedProvider.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/providers/LLFirIdePredicateBasedProvider.kt @@ -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 } } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt index 5f678129635..6ce69988b02 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt @@ -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) } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicate.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicate.kt index 8ce4ecc36d9..56a4465da89 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicate.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicate.kt @@ -100,9 +100,9 @@ class AnnotatedWith(annotations: Set) : Annotated(annotations) { * * Matched symbols: [fun A.baz, class Nested, fun Nested.foobar] */ -class UnderAnnotatedWith(annotations: Set) : Annotated(annotations) { +class AncestorAnnotatedWith(annotations: Set) : Annotated(annotations) { override fun accept(visitor: DeclarationPredicateVisitor, 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) : MetaAnnotated(metaAnnotations) { +class MetaAnnotatedWith(metaAnnotations: Set) : MetaAnnotated(metaAnnotations) { override fun accept(visitor: DeclarationPredicateVisitor, data: D): R { - return visitor.visitAnnotatedWithMeta(this, data) + return visitor.visitMetaAnnotatedWith(this, data) } } -class UnderMetaAnnotated(metaAnnotations: Set) : MetaAnnotated(metaAnnotations) { +class AncestorMetaAnnotatedWith(metaAnnotations: Set) : MetaAnnotated(metaAnnotations) { override fun accept(visitor: DeclarationPredicateVisitor, 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): DeclarationPredicate = UnderAnnotatedWith(annotations.toSet()) fun annotated(annotations: Collection): DeclarationPredicate = AnnotatedWith(annotations.toSet()) +fun ancestorAnnotated(annotations: Collection): DeclarationPredicate = AncestorAnnotatedWith(annotations.toSet()) fun parentAnnotated(annotations: Collection): DeclarationPredicate = ParentAnnotatedWith(annotations.toSet()) fun hasAnnotated(annotations: Collection): DeclarationPredicate = HasAnnotatedWith(annotations.toSet()) -fun metaUnder(metaAnnotations: Collection): DeclarationPredicate = UnderMetaAnnotated(metaAnnotations.toSet()) -fun metaAnnotated(metaAnnotations: Collection): DeclarationPredicate = AnnotatedWithMeta(metaAnnotations.toSet()) +fun metaAnnotated(metaAnnotations: Collection): DeclarationPredicate = MetaAnnotatedWith(metaAnnotations.toSet()) +fun metaAncestorAnnotated(metaAnnotations: Collection): DeclarationPredicate = AncestorMetaAnnotatedWith(metaAnnotations.toSet()) fun parentMetaAnnotated(metaAnnotations: Collection): DeclarationPredicate = ParentMetaAnnotatedWith(metaAnnotations.toSet()) fun hasMetaAnnotated(metaAnnotations: Collection): DeclarationPredicate = HasMetaAnnotatedWith(metaAnnotations.toSet()) -fun annotatedOrUnder(annotations: Collection): DeclarationPredicate = annotated(annotations) or under(annotations) +fun annotatedOrUnder(annotations: Collection): DeclarationPredicate = annotated(annotations) or ancestorAnnotated(annotations) fun metaAnnotatedOrUnder(metaAnnotations: Collection): DeclarationPredicate = - metaAnnotated(metaAnnotations) or metaUnder(metaAnnotations) + metaAnnotated(metaAnnotations) or metaAncestorAnnotated(metaAnnotations) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicateVisitor.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicateVisitor.kt index 0a98448c8cd..4686495e28f 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicateVisitor.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/predicate/DeclarationPredicateVisitor.kt @@ -24,7 +24,7 @@ abstract class DeclarationPredicateVisitor { 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 { 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) }