diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-09-18 15:53:37 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-09-28 16:54:22 +0200 |
commit | 2274d9261a59570cc3a1a26c3f7ddc167678fe8b (patch) | |
tree | bde5200a8d97b77d07db18a153b107c4b39bad1e /plugins/base/src/main/kotlin/translators | |
parent | 4b4bd919f0ae94190d475c99c3d5fa0140822b84 (diff) | |
download | dokka-2274d9261a59570cc3a1a26c3f7ddc167678fe8b.tar.gz dokka-2274d9261a59570cc3a1a26c3f7ddc167678fe8b.tar.bz2 dokka-2274d9261a59570cc3a1a26c3f7ddc167678fe8b.zip |
Add default values for primitive proprties. Add presenting in signature default values
Diffstat (limited to 'plugins/base/src/main/kotlin/translators')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt | 11 |
1 files changed, 7 insertions, 4 deletions
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() |