aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/DokkaDescriptorVisitor.kt15
-rw-r--r--core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt4
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)