Analysis API: add KDoc, small cosmetic improvements
This commit is contained in:
+3
-3
@@ -299,9 +299,9 @@ internal fun ConstantValue<*>.toKtAnnotationValue(): KtAnnotationValue {
|
||||
is KClassValue -> when (val value = value) {
|
||||
is KClassValue.Value.LocalClass -> {
|
||||
val descriptor = value.type.constructor.declarationDescriptor as ClassDescriptor
|
||||
KtLocalKClassAnnotationValue(descriptor.source.getPsi() as KtClassOrObject, sourcePsi = null)
|
||||
KtKClassAnnotationValue.KtLocalKClassAnnotationValue(descriptor.source.getPsi() as KtClassOrObject, sourcePsi = null)
|
||||
}
|
||||
is KClassValue.Value.NormalClass -> KtNonLocalKClassAnnotationValue(value.classId, sourcePsi = null)
|
||||
is KClassValue.Value.NormalClass -> KtKClassAnnotationValue.KtNonLocalKClassAnnotationValue(value.classId, sourcePsi = null)
|
||||
}
|
||||
|
||||
is AnnotationValue -> {
|
||||
@@ -461,5 +461,5 @@ internal fun AnnotationDescriptor.toKtAnnotationApplication(): KtAnnotationAppli
|
||||
|
||||
internal fun AnnotationDescriptor.getKtNamedAnnotationArguments() =
|
||||
allValueArguments.map { (name, value) ->
|
||||
KtNamedAnnotationValue(name.asString(), value.toKtAnnotationValue())
|
||||
KtNamedAnnotationValue(name, value.toKtAnnotationValue())
|
||||
}
|
||||
+3
-2
@@ -109,7 +109,8 @@ internal class KtFe10TypeRenderer(private val options: KtTypeRendererOptions, pr
|
||||
}
|
||||
|
||||
printCollection(namedValues, separator = ", ", prefix = "(", postfix = ")") { (name, value) ->
|
||||
append(name).append(" = ")
|
||||
append(name.render())
|
||||
append(" = ")
|
||||
renderConstantValueDebug(value)
|
||||
}
|
||||
}
|
||||
@@ -122,7 +123,7 @@ internal class KtFe10TypeRenderer(private val options: KtTypeRendererOptions, pr
|
||||
is KtEnumEntryAnnotationValue -> append(value.callableId?.asSingleFqName()?.render())
|
||||
is KtConstantAnnotationValue -> append(value.constantValue.constantValueKind.asString).append("(").append(value.constantValue.value.toString()).append(")")
|
||||
KtUnsupportedAnnotationValue -> append(KtUnsupportedAnnotationValue::class.java.simpleName)
|
||||
is KtKClassAnnotationValue -> append(value.render())
|
||||
is KtKClassAnnotationValue -> append(value.renderAsSourceCode())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.utils
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.renderAsSourceCode
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.classId
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationValueRenderer
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtAnnotationValue
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.PrettyPrinter
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
@@ -39,7 +39,7 @@ internal fun PrettyPrinter.renderFe10Annotations(
|
||||
printCollectionIfNotEmpty(valueArguments, separator = ", ", prefix = "(", postfix = ")") { (name, value) ->
|
||||
append(name.render())
|
||||
append(" = ")
|
||||
append(KtAnnotationValueRenderer.render(value.toKtAnnotationValue()))
|
||||
append(value.toKtAnnotationValue().renderAsSourceCode())
|
||||
}
|
||||
|
||||
append(separator)
|
||||
|
||||
Reference in New Issue
Block a user