aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-12-22 17:38:56 +0300
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-12-22 17:38:56 +0300
commitc759876cf6401e11311be0e480233592ed627bb4 (patch)
tree22ef31c737c5a81aef85ba0a31bbdfd7131124b0
parent7d81b307b74be72e945184d4ba26c833a25a497d (diff)
downloaddokka-c759876cf6401e11311be0e480233592ed627bb4.tar.gz
dokka-c759876cf6401e11311be0e480233592ed627bb4.tar.bz2
dokka-c759876cf6401e11311be0e480233592ed627bb4.zip
Append modifiers and visibility to property accessors
-rw-r--r--src/Kotlin/DocumentationBuilder.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 7d38480a..d2c07200 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -35,14 +35,18 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
fun DocumentationNode<T>(descriptor: T, kind: Kind): DocumentationNode where T : DeclarationDescriptor, T : Named {
val doc = parseDocumentation(descriptor)
- val node = DocumentationNode(descriptor.getName().asString(), doc, kind)
+ val node = DocumentationNode(descriptor.getName().asString(), doc, kind).withModifiers(descriptor)
+ return node
+ }
+
+ private fun DocumentationNode.withModifiers(descriptor: DeclarationDescriptor) : DocumentationNode{
if (descriptor is MemberDescriptor) {
- node.appendVisibility(descriptor)
+ appendVisibility(descriptor)
if (descriptor !is ConstructorDescriptor) {
- node.appendModality(descriptor)
+ appendModality(descriptor)
}
}
- return node
+ return this
}
fun DocumentationNode.append(child: DocumentationNode, kind: DocumentationReference.Kind) {
@@ -188,7 +192,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
fun PropertyAccessorDescriptor.build(): DocumentationNode {
val doc = parseDocumentation(this)
val specialName = getName().asString().drop(1).takeWhile { it != '-' }
- val node = DocumentationNode(specialName, doc, Kind.PropertyAccessor)
+ val node = DocumentationNode(specialName, doc, Kind.PropertyAccessor).withModifiers(this)
node.appendChildren(getValueParameters(), DocumentationReference.Kind.Detail)
node.appendType(getReturnType())