aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/DocumentationNodeBuilder.kt
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-10-03 15:57:16 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-10-03 15:57:16 +0400
commita52e1d543d22fdacf87ec00988b753d2d1107c1d (patch)
tree0b27f4aa91494d715044af79dead49c6e4f3fc00 /src/Kotlin/DocumentationNodeBuilder.kt
parente93b629e4b2fa70330d94b8cb77f3ae34d1a9960 (diff)
downloaddokka-a52e1d543d22fdacf87ec00988b753d2d1107c1d.tar.gz
dokka-a52e1d543d22fdacf87ec00988b753d2d1107c1d.tar.bz2
dokka-a52e1d543d22fdacf87ec00988b753d2d1107c1d.zip
Work on cross-references.
Diffstat (limited to 'src/Kotlin/DocumentationNodeBuilder.kt')
-rw-r--r--src/Kotlin/DocumentationNodeBuilder.kt18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Kotlin/DocumentationNodeBuilder.kt b/src/Kotlin/DocumentationNodeBuilder.kt
index 535f037f..66f71bf6 100644
--- a/src/Kotlin/DocumentationNodeBuilder.kt
+++ b/src/Kotlin/DocumentationNodeBuilder.kt
@@ -21,10 +21,11 @@ class DocumentationNodeBuilder(val context: DocumentationContext) : DeclarationD
fun reference(from: DocumentationNode, to: DocumentationNode, kind: DocumentationReference.Kind) {
from.addReferenceTo(to, kind)
- if (kind == DocumentationReference.Kind.Link)
- to.addReferenceTo(from, DocumentationReference.Kind.Link)
- else
- to.addReferenceTo(from, DocumentationReference.Kind.Owner)
+ when (kind) {
+ DocumentationReference.Kind.Detail -> to.addReferenceTo(from, DocumentationReference.Kind.Owner)
+ DocumentationReference.Kind.Member -> to.addReferenceTo(from, DocumentationReference.Kind.Owner)
+ DocumentationReference.Kind.Owner -> to.addReferenceTo(from, DocumentationReference.Kind.Member)
+ }
}
fun addModality(descriptor: MemberDescriptor, data: DocumentationNode) {
@@ -42,15 +43,16 @@ class DocumentationNodeBuilder(val context: DocumentationContext) : DeclarationD
fun addType(descriptor: DeclarationDescriptor, t: JetType?, data: DocumentationNode) {
if (t == null)
return
- val typeConstructor = t.getConstructor()
- val classifierDescriptor = typeConstructor.getDeclarationDescriptor()
+ val classifierDescriptor = t.getConstructor().getDeclarationDescriptor()
val name = when (classifierDescriptor) {
is Named -> classifierDescriptor.getName().asString()
else -> "<anonymous>"
}
val node = DocumentationNode(name, Content.Empty, DocumentationNode.Kind.Type)
- reference(data, node, DocumentationReference.Kind.Detail)
+ if (classifierDescriptor != null)
+ context.attach(node, classifierDescriptor)
+ reference(data, node, DocumentationReference.Kind.Detail)
for (param in t.getArguments())
addType(descriptor, param.getType(), node)
}
@@ -59,7 +61,7 @@ class DocumentationNodeBuilder(val context: DocumentationContext) : DeclarationD
descriptor!!
val doc = context.parseDocumentation(descriptor)
val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNode.Kind.Unknown)
- reference(data!!, node, DocumentationReference.Kind.Link)
+ reference(data!!, node, DocumentationReference.Kind.Member)
context.register(descriptor, node)
return node
}