aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Generation/JavaSignatureGenerator.kt11
-rw-r--r--src/Generation/KotlinSignatureGenerator.kt20
-rw-r--r--src/Generation/SignatureGenerator.kt1
3 files changed, 25 insertions, 7 deletions
diff --git a/src/Generation/JavaSignatureGenerator.kt b/src/Generation/JavaSignatureGenerator.kt
index e7458eba..01e51d74 100644
--- a/src/Generation/JavaSignatureGenerator.kt
+++ b/src/Generation/JavaSignatureGenerator.kt
@@ -23,6 +23,13 @@ class JavaSignatureGenerator : SignatureGenerator {
}
}
+ override fun renderName(node: DocumentationNode): String {
+ return when (node.kind) {
+ Kind.Constructor -> node.owner!!.name
+ else -> node.name
+ }
+ }
+
override fun renderPackage(node: DocumentationNode): String {
return "package ${node.name}"
}
@@ -99,9 +106,7 @@ class JavaSignatureGenerator : SignatureGenerator {
override fun renderFunction(node: DocumentationNode): String {
return StringBuilder {
when (node.kind) {
- Kind.Constructor -> {
- append(node.owner?.name)
- }
+ Kind.Constructor -> append(node.owner?.name)
Kind.Function -> {
append(renderTypeParametersForNode(node))
append(renderType(node.detail(Kind.Type)))
diff --git a/src/Generation/KotlinSignatureGenerator.kt b/src/Generation/KotlinSignatureGenerator.kt
index e73dd8d9..6bdf9562 100644
--- a/src/Generation/KotlinSignatureGenerator.kt
+++ b/src/Generation/KotlinSignatureGenerator.kt
@@ -24,6 +24,13 @@ class KotlinSignatureGenerator : SignatureGenerator {
}
}
+ override fun renderName(node: DocumentationNode): String {
+ return when (node.kind) {
+ Kind.Constructor -> node.owner!!.name
+ else -> node.name
+ }
+ }
+
override fun renderPackage(node: DocumentationNode): String {
return "package ${node.name}"
}
@@ -99,9 +106,14 @@ class KotlinSignatureGenerator : SignatureGenerator {
append(node.name)
append(renderTypeParametersForNode(node))
- append("(")
- append(node.details(Kind.Parameter).map { renderParameter(it) }.join())
- append(")")
+ /*
+ val constructors = node.members(Kind.Constructor)
+ if (constructors.count() == 1) {
+ append("(")
+ append(constructors[0].details(Kind.Parameter).map { renderParameter(it) }.join())
+ append(")")
+ }
+ */
}.toString()
}
@@ -109,7 +121,7 @@ class KotlinSignatureGenerator : SignatureGenerator {
return StringBuilder {
append(renderModifiersForNode(node))
when (node.kind) {
- Kind.Constructor -> append("init")
+ Kind.Constructor -> append(node.owner!!.name)
Kind.Function -> append("fun ")
else -> throw IllegalArgumentException("Node $node is not a function-like object")
}
diff --git a/src/Generation/SignatureGenerator.kt b/src/Generation/SignatureGenerator.kt
index 158c4336..81302433 100644
--- a/src/Generation/SignatureGenerator.kt
+++ b/src/Generation/SignatureGenerator.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka
trait SignatureGenerator {
fun render(node: DocumentationNode): String
+ fun renderName(node: DocumentationNode): String
fun renderFunction(node: DocumentationNode): String
fun renderClass(node: DocumentationNode): String
fun renderTypeParametersForNode(node: DocumentationNode): String