aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/DocumentationBuilder.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2014-12-29 20:50:26 +0100
committerDmitry Jemerov <yole@jetbrains.com>2014-12-29 20:57:25 +0100
commitcedaeb48615cf6f9aae3cbcd3917e9827ca5e67f (patch)
tree00358b0477c93a3fd3f1d09ce81d9028dddfc145 /src/Kotlin/DocumentationBuilder.kt
parent7db96f8da4317cd290ccc9f988c534f10923dbbb (diff)
downloaddokka-cedaeb48615cf6f9aae3cbcd3917e9827ca5e67f.tar.gz
dokka-cedaeb48615cf6f9aae3cbcd3917e9827ca5e67f.tar.bz2
dokka-cedaeb48615cf6f9aae3cbcd3917e9827ca5e67f.zip
put class object functions and properties in main class block
Diffstat (limited to 'src/Kotlin/DocumentationBuilder.kt')
-rw-r--r--src/Kotlin/DocumentationBuilder.kt15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index d2c07200..aeea4a55 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -161,11 +161,13 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
if (getKind() != ClassKind.OBJECT) {
node.appendChildren(getTypeConstructor().getParameters(), DocumentationReference.Kind.Detail)
node.appendChildren(getConstructors(), DocumentationReference.Kind.Member)
- val classObjectDescriptor = getClassObjectDescriptor()
- if (classObjectDescriptor != null)
- node.appendChild(classObjectDescriptor, DocumentationReference.Kind.Member)
}
node.appendChildren(getDefaultType().getMemberScope().getAllDescriptors(), DocumentationReference.Kind.Member)
+ val classObjectDescriptor = getClassObjectDescriptor()
+ if (classObjectDescriptor != null) {
+ node.appendChildren(classObjectDescriptor.getDefaultType().getMemberScope().getAllDescriptors(),
+ DocumentationReference.Kind.Member)
+ }
register(this, node)
return node
}
@@ -177,8 +179,11 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
return node
}
+ private fun DeclarationDescriptor.inClassObject() =
+ getContainingDeclaration().let { it is ClassDescriptor && it.getKind() == ClassKind.CLASS_OBJECT }
+
fun FunctionDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, Kind.Function)
+ val node = DocumentationNode(this, if (inClassObject()) Kind.ClassObjectFunction else Kind.Function)
node.appendChildren(getTypeParameters(), DocumentationReference.Kind.Detail)
getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
@@ -201,7 +206,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
}
fun PropertyDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, Kind.Property)
+ val node = DocumentationNode(this, if (inClassObject()) Kind.ClassObjectProperty else Kind.Property)
node.appendChildren(getTypeParameters(), DocumentationReference.Kind.Detail)
getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
node.appendType(getReturnType())