diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-14 20:02:02 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-14 20:02:02 +0100 |
commit | 03d942bb95cf1064488ba2c14d9455c19f9c922e (patch) | |
tree | 74d1247a4bc236e5eac27e3462d85ad772ee2877 /src/Kotlin/KotlinLanguageService.kt | |
parent | 60e610ebdd86663bedf113d2235ac3c8364171d0 (diff) | |
download | dokka-03d942bb95cf1064488ba2c14d9455c19f9c922e.tar.gz dokka-03d942bb95cf1064488ba2c14d9455c19f9c922e.tar.bz2 dokka-03d942bb95cf1064488ba2c14d9455c19f9c922e.zip |
show signatures for accessors
Diffstat (limited to 'src/Kotlin/KotlinLanguageService.kt')
-rw-r--r-- | src/Kotlin/KotlinLanguageService.kt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index 8795aba6..f598a38e 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -25,7 +25,8 @@ class KotlinLanguageService : LanguageService { DocumentationNode.Kind.Modifier -> renderModifier(node) DocumentationNode.Kind.Constructor, DocumentationNode.Kind.Function, - DocumentationNode.Kind.ClassObjectFunction -> renderFunction(node) + DocumentationNode.Kind.ClassObjectFunction, + DocumentationNode.Kind.PropertyAccessor -> renderFunction(node) DocumentationNode.Kind.Property, DocumentationNode.Kind.ClassObjectProperty -> renderProperty(node) else -> ContentText("${node.kind}: ${node.name}") @@ -209,6 +210,7 @@ class KotlinLanguageService : LanguageService { DocumentationNode.Kind.Constructor -> identifier(node.owner!!.name) DocumentationNode.Kind.Function, DocumentationNode.Kind.ClassObjectFunction -> keyword("fun ") + DocumentationNode.Kind.PropertyAccessor -> {} else -> throw IllegalArgumentException("Node $node is not a function-like object") } renderTypeParametersForNode(node) @@ -226,12 +228,18 @@ class KotlinLanguageService : LanguageService { renderParameter(it) } symbol(")") - if (node.kind != org.jetbrains.dokka.DocumentationNode.Kind.Constructor) { + if (needReturnType(node)) { symbol(": ") renderType(node.detail(DocumentationNode.Kind.Type)) } } + private fun needReturnType(node: DocumentationNode) = when(node.kind) { + DocumentationNode.Kind.Constructor -> false + DocumentationNode.Kind.PropertyAccessor -> node.name == "get" + else -> true + } + private fun ContentNode.renderProperty(node: DocumentationNode) { renderModifiersForNode(node) renderAnnotationsForNode(node) |