diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2019-11-05 17:37:38 +0100 |
---|---|---|
committer | Paweł Marks <pmarks@virtuslab.com> | 2019-11-05 17:37:38 +0100 |
commit | 5f50151f4aa9950de67f7b402eb8c273f7a0935b (patch) | |
tree | d80cf504d959f5c9b17ccefdb35acb5a30cd86e8 /core | |
parent | 940cf84196f0cd0dbeafae2f0ec5f73a49b68285 (diff) | |
download | dokka-5f50151f4aa9950de67f7b402eb8c273f7a0935b.tar.gz dokka-5f50151f4aa9950de67f7b402eb8c273f7a0935b.tar.bz2 dokka-5f50151f4aa9950de67f7b402eb8c273f7a0935b.zip |
Solves problems with constructor descriptors
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/DokkaDescriptorVisitor.kt | 15 | ||||
-rw-r--r-- | core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/core/src/main/kotlin/DokkaDescriptorVisitor.kt b/core/src/main/kotlin/DokkaDescriptorVisitor.kt index ac54635b..b6d622e5 100644 --- a/core/src/main/kotlin/DokkaDescriptorVisitor.kt +++ b/core/src/main/kotlin/DokkaDescriptorVisitor.kt @@ -68,10 +68,17 @@ object DokkaDescriptorVisitor : DeclarationDescriptorVisitorEmptyBodies<Document ) } - override fun visitConstructorDescriptor( - descriptor: ConstructorDescriptor, - parent: DRI - ) = visitFunctionDescriptor(descriptor, parent) + override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor, parent: DRI): Function { + val dri = parent.copy(callable = Callable.from(descriptor)) + return Function( + dri, + "<init>", + null, + descriptor.valueParameters.mapIndexed { index, desc -> parameter(index, desc, dri) }, + descriptor.findKDoc(), + descriptor + ) + } override fun visitReceiverParameterDescriptor( descriptor: ReceiverParameterDescriptor, diff --git a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt index a3966d62..273b47d0 100644 --- a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt +++ b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt @@ -7,6 +7,7 @@ import org.jetbrains.dokka.Model.Function import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.parseMarkdown +import org.jetbrains.kotlin.descriptors.ConstructorDescriptor import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.types.KotlinType @@ -61,7 +62,6 @@ class DefaultDocumentationToPageTransformer( block("Types", p.classes) { link(it.name, it.dri) text(it.briefDocstring) - text("signature for class") } block("Functions", p.functions) { link(it.name, it.dri) @@ -171,7 +171,7 @@ class DefaultDocumentationToPageTransformer( } text(")") val returnType = f.descriptor.returnType - if (returnType != null && + if (f.descriptor !is ConstructorDescriptor && returnType != null && returnType.constructor.declarationDescriptor?.fqNameSafe?.asString() != Unit::class.qualifiedName) { text(": ") type(returnType) |