Render '@' before each annotation

This commit is contained in:
Denis Zharkov
2015-09-15 19:40:26 +03:00
parent f518348565
commit 7ea7e3cc7c
11 changed files with 60 additions and 82 deletions
@@ -104,7 +104,7 @@ private class CallableClsStubBuilder(
val kind = callableProto.annotatedCallableKind
val annotationIds = c.components.annotationLoader.loadCallableAnnotations(protoContainer, callableProto, c.nameResolver, kind)
createTargetedAnnotationStubs(annotationIds, modifierListStubImpl, needWrappingAnnotationEntries = isPrimaryConstructor)
createTargetedAnnotationStubs(annotationIds, modifierListStubImpl)
}
private fun doCreateCallableStub(): StubElement<out PsiElement> {
@@ -94,7 +94,7 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
}
private fun createTypeAnnotationStubs(parent: KotlinStubBaseImpl<*>, annotations: List<ClassId>) {
createAnnotationStubs(annotations, parent, needWrappingAnnotationEntries = true)
createAnnotationStubs(annotations, parent)
}
private fun createTypeArgumentListStub(typeStub: KotlinUserTypeStub, typeArgumentProtoList: List<Type.Argument>) {
@@ -216,25 +216,20 @@ fun createModifierListStub(
)
}
fun createAnnotationStubs(annotationIds: List<ClassId>, parent: KotlinStubBaseImpl<*>, needWrappingAnnotationEntries: Boolean = false) {
return createTargetedAnnotationStubs(annotationIds.map { ClassIdWithTarget(it, null) }, parent, needWrappingAnnotationEntries)
fun createAnnotationStubs(annotationIds: List<ClassId>, parent: KotlinStubBaseImpl<*>) {
return createTargetedAnnotationStubs(annotationIds.map { ClassIdWithTarget(it, null) }, parent)
}
fun createTargetedAnnotationStubs(
annotationIds: List<ClassIdWithTarget>,
parent: KotlinStubBaseImpl<*>,
needWrappingAnnotationEntries: Boolean = false
parent: KotlinStubBaseImpl<*>
) {
if (annotationIds.isEmpty()) return
val entriesParent =
if (needWrappingAnnotationEntries) KotlinPlaceHolderStubImpl<JetAnnotation>(parent, JetStubElementTypes.ANNOTATION)
else parent
annotationIds.forEach { annotation ->
val (annotationClassId, target) = annotation
val annotationEntryStubImpl = KotlinAnnotationEntryStubImpl(
entriesParent,
parent,
shortName = annotationClassId.getShortClassName().ref(),
hasValueArguments = false
)