diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-10-03 19:09:31 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-10-03 19:09:31 +0400 |
commit | 7c6da4babd01da31c57c5c6c827eb2957c989b1c (patch) | |
tree | 1cc063c24326044b9ee968b2278e0864e8ee7051 /src/Kotlin | |
parent | a52e1d543d22fdacf87ec00988b753d2d1107c1d (diff) | |
download | dokka-7c6da4babd01da31c57c5c6c827eb2957c989b1c.tar.gz dokka-7c6da4babd01da31c57c5c6c827eb2957c989b1c.tar.bz2 dokka-7c6da4babd01da31c57c5c6c827eb2957c989b1c.zip |
Language Service now formats to ContentNode instead of String.
Diffstat (limited to 'src/Kotlin')
-rw-r--r-- | src/Kotlin/CrossReferences.kt | 14 | ||||
-rw-r--r-- | src/Kotlin/DocumentationNodeBuilder.kt | 13 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/Kotlin/CrossReferences.kt b/src/Kotlin/CrossReferences.kt index 7504cebc..bfab8309 100644 --- a/src/Kotlin/CrossReferences.kt +++ b/src/Kotlin/CrossReferences.kt @@ -19,19 +19,19 @@ public fun DocumentationContext.buildCrossReferences(node: DocumentationNode) { typeNode?.addReferenceTo(node, DocumentationReference.Kind.Extension) } } - node.details(DocumentationNode.Kind.Type).forEach { detail -> + node.details(DocumentationNode.Kind.Supertype).forEach { detail -> val descriptor = relations[detail] if (descriptor != null) { val typeNode = descriptorToNode[descriptor] - if (typeNode != null) { - // if typeNode is null, type is external to module - detail.addReferenceTo(typeNode, DocumentationReference.Kind.Link) - } + typeNode?.addReferenceTo(node, DocumentationReference.Kind.Inheritor) } } - for (member in node.members) { - buildCrossReferences(member) + for (child in node.members) { + buildCrossReferences(child) + } + for (child in node.details) { + buildCrossReferences(child) } } diff --git a/src/Kotlin/DocumentationNodeBuilder.kt b/src/Kotlin/DocumentationNodeBuilder.kt index 66f71bf6..f29a17d5 100644 --- a/src/Kotlin/DocumentationNodeBuilder.kt +++ b/src/Kotlin/DocumentationNodeBuilder.kt @@ -40,6 +40,18 @@ class DocumentationNodeBuilder(val context: DocumentationContext) : DeclarationD reference(data, node, DocumentationReference.Kind.Detail) } + fun addSupertypes(descriptor: ClassDescriptor, data: DocumentationNode) { + val superTypes = descriptor.getTypeConstructor().getSupertypes() + for (superType in superTypes) { + val superDescriptor = superType.getConstructor().getDeclarationDescriptor() + if (superDescriptor != null && superType.toString() != "Any") { + val node = DocumentationNode(superType.toString(), Content.Empty, DocumentationNode.Kind.Supertype) + context.attach(node, superDescriptor) + reference(data, node, DocumentationReference.Kind.Detail) + } + } + } + fun addType(descriptor: DeclarationDescriptor, t: JetType?, data: DocumentationNode) { if (t == null) return @@ -101,6 +113,7 @@ class DocumentationNodeBuilder(val context: DocumentationContext) : DeclarationD reference(data!!, node, DocumentationReference.Kind.Member) addModality(descriptor, node) addVisibility(descriptor, node) + addSupertypes(descriptor, node) context.register(descriptor, node) return node } |