Remove use-site targeted annotations from LazyAnnotations

LazyAnnotations are only used for classes and files, and in the latter
case it will now contain file annotations as normal annotations, without
the target "file:"
This commit is contained in:
Alexander Udalov
2018-08-22 19:54:23 +02:00
parent 98232265d7
commit f9b9b6908a
10 changed files with 12 additions and 27 deletions
@@ -56,27 +56,12 @@ class LazyAnnotations(
override fun isEmpty() = annotationEntries.isEmpty()
private val annotation = c.storageManager.createMemoizedFunction { entry: KtAnnotationEntry ->
val descriptor = LazyAnnotationDescriptor(c, entry)
val target = entry.useSiteTarget?.getAnnotationUseSiteTarget()
AnnotationWithTarget(descriptor, target)
LazyAnnotationDescriptor(c, entry)
}
override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> {
return annotationEntries
.mapNotNull {
val (descriptor, target) = annotation(it)
if (target == null) null else AnnotationWithTarget(descriptor, target)
}
}
override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> = emptyList()
override fun iterator(): Iterator<AnnotationDescriptor> {
return annotationEntries
.asSequence()
.mapNotNull {
val (descriptor, target) = annotation(it)
if (target == null) descriptor else null // Filter out annotations with target
}.iterator()
}
override fun iterator(): Iterator<AnnotationDescriptor> = annotationEntries.asSequence().map(annotation).iterator()
override fun forceResolveAllContents() {
// To resolve all entries