diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-14 20:32:06 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-14 20:32:06 +0100 |
commit | 555caef67698f6932217419fe63a040cc0aeb822 (patch) | |
tree | 327f04c793e2a6fc11af3e006aa635c933d51bf8 /src/Kotlin | |
parent | 807451f9ad9664e7b26cc50c4f08a2a9bf3be538 (diff) | |
parent | 03d942bb95cf1064488ba2c14d9455c19f9c922e (diff) | |
download | dokka-555caef67698f6932217419fe63a040cc0aeb822.tar.gz dokka-555caef67698f6932217419fe63a040cc0aeb822.tar.bz2 dokka-555caef67698f6932217419fe63a040cc0aeb822.zip |
Merge branch 'accessor-signature'
Conflicts:
test/src/format/MarkdownFormatTest.kt
Diffstat (limited to 'src/Kotlin')
-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 80a76791..b7723285 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}") @@ -214,6 +215,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) @@ -231,12 +233,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) |