aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt6
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt11
2 files changed, 13 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 324ef303..0a22cece 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -220,6 +220,9 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
link(p.name, p.dri)
text(": ")
signatureForProjection(p.type)
+ p.extra[DefaultValue]?.run {
+ text(" = $value")
+ }
}
}
@@ -255,6 +258,9 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
text(it.name!!)
text(": ")
signatureForProjection(it.type)
+ it.extra[DefaultValue]?.run {
+ text(" = $value")
+ }
}
text(")")
if (f.documentReturnType()) {
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index b1c82efb..f58b2b36 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -343,11 +343,12 @@ private class DokkaDescriptorVisitor(
sourceSets = setOf(sourceSet),
generics = descriptor.typeParameters.map { it.toVariantTypeParameter() },
isExpectActual = (isExpect || isActual),
- extra = PropertyContainer.withAll(
+ extra = PropertyContainer.withAll(listOfNotNull(
(descriptor.additionalExtras() + descriptor.getAnnotationsWithBackingField()
.toAdditionalExtras()).toSet().toSourceSetDependent().toAdditionalModifiers(),
- descriptor.getAnnotationsWithBackingField().toSourceSetDependent().toAnnotations()
- )
+ descriptor.getAnnotationsWithBackingField().toSourceSetDependent().toAnnotations(),
+ descriptor.getDefaultValue()?.let { DefaultValue(it) }
+ ))
)
}
@@ -770,10 +771,12 @@ private class DokkaDescriptorVisitor(
}
}
-
private fun ValueParameterDescriptor.getDefaultValue(): String? =
(source as? KotlinSourceElement)?.psi?.children?.find { it is KtExpression }?.text
+ private fun PropertyDescriptor.getDefaultValue(): String? =
+ (source as? KotlinSourceElement)?.psi?.children?.find { it is KtConstantExpression }?.text
+
private fun ClassDescriptor.getAppliedConstructorParameters() =
(source as PsiSourceElement).psi?.children?.flatMap {
it.safeAs<KtInitializerList>()?.initializersAsText().orEmpty()