aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-10-27 18:44:07 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-10-29 11:57:21 +0100
commitae2ff5b82931666fc908750d39e31bd6dc39359f (patch)
tree0f10373cc3dde39ca4a36290b6f06540611b7394 /src/Kotlin
parent8291bee3a86f5f2409ba4ae44c87f291c664ac19 (diff)
downloaddokka-ae2ff5b82931666fc908750d39e31bd6dc39359f.tar.gz
dokka-ae2ff5b82931666fc908750d39e31bd6dc39359f.tar.bz2
dokka-ae2ff5b82931666fc908750d39e31bd6dc39359f.zip
don't show Unit return type in signatures
Diffstat (limited to 'src/Kotlin')
-rw-r--r--src/Kotlin/KotlinLanguageService.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 0d1d6b85..038ade9c 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -341,19 +341,25 @@ class KotlinLanguageService : LanguageService {
indentedSoftLineBreak()
renderParameter(it, renderMode)
}
- softLineBreak()
- symbol(")")
if (needReturnType(node)) {
+ softLineBreak()
+ symbol(")")
symbol(": ")
renderType(node.detail(DocumentationNode.Kind.Type))
}
+ else {
+ symbol(")")
+ }
}
private fun needReturnType(node: DocumentationNode) = when(node.kind) {
DocumentationNode.Kind.Constructor -> false
- else -> true
+ else -> !node.isUnitReturnType()
}
+ fun DocumentationNode.isUnitReturnType(): Boolean =
+ detail(DocumentationNode.Kind.Type).hiddenLinks.firstOrNull()?.qualifiedName() == "kotlin.Unit"
+
private fun ContentBlock.renderProperty(node: DocumentationNode, renderMode: RenderMode) {
if (renderMode == RenderMode.FULL) {
renderAnnotationsForNode(node)