Analysis API: add KDoc, small cosmetic improvements

This commit is contained in:
Ilya Kirillov
2021-11-30 16:15:51 +01:00
parent 6e4c87f138
commit dc9c2aa39d
15 changed files with 173 additions and 50 deletions
@@ -45,7 +45,7 @@ private class FirNameValuePairForAnnotationArgument(
override fun setValue(p0: PsiAnnotationMemberValue) = cannotModify()
private val _nameIdentifier: PsiIdentifier by lazyPub {
LightIdentifier(parent.manager, constantValue.name)
LightIdentifier(parent.manager, constantValue.name.asString())
}
override fun getNameIdentifier(): PsiIdentifier = _nameIdentifier
@@ -54,5 +54,5 @@ private class FirNameValuePairForAnnotationArgument(
override fun getLiteralValue(): String? = (value as? PsiLiteralExpression)?.value?.toString()
override fun getName(): String = constantValue.name
override fun getName(): String = constantValue.name.asString()
}
@@ -202,13 +202,13 @@ internal fun KtAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiA
FirPsiExpression(sourcePsi, parent, psiExpression)
}
KtUnsupportedAnnotationValue -> null
is KtErrorClassAnnotationValue -> null
is KtLocalKClassAnnotationValue -> null
is KtNonLocalKClassAnnotationValue -> toAnnotationMemberValue(parent)
is KtKClassAnnotationValue.KtErrorClassAnnotationValue -> null
is KtKClassAnnotationValue.KtLocalKClassAnnotationValue -> null
is KtKClassAnnotationValue.KtNonLocalKClassAnnotationValue -> toAnnotationMemberValue(parent)
}
}
private fun KtNonLocalKClassAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiExpression? {
private fun KtKClassAnnotationValue.KtNonLocalKClassAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiExpression? {
val fqName = classId.asSingleFqName()
val canonicalText = psiType(
fqName.asString(), parent, boxPrimitiveType = false /* TODO value.arrayNestedness > 0*/,