aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-03-01 22:26:28 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-03-01 22:26:28 +0300
commitabe161a118d3d7df40ad0e1df8b8adf07773103b (patch)
tree4176768eaaac9eec7240fdcbb954238d790edae8 /core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
parent1934463c0a2a708acfde371daf0692811f479a7a (diff)
downloaddokka-abe161a118d3d7df40ad0e1df8b8adf07773103b.tar.gz
dokka-abe161a118d3d7df40ad0e1df8b8adf07773103b.tar.bz2
dokka-abe161a118d3d7df40ad0e1df8b8adf07773103b.zip
Correct merging of different type namesake declarations between platforms
Diffstat (limited to 'core/src/main/kotlin/Kotlin/DocumentationBuilder.kt')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index fcb86d53..299ad477 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -278,11 +278,36 @@ class DocumentationBuilder
return null
}
+ fun createGroupNode(signature: String, nodes: List<DocumentationNode>) = (nodes.find { it.kind == NodeKind.GroupNode } ?:
+ DocumentationNode(nodes.first().name, Content.Empty, NodeKind.GroupNode).apply {
+ appendTextNode(signature, NodeKind.Signature, RefKind.Detail)
+ })
+ .also { groupNode ->
+ nodes.forEach { node ->
+ if (node != groupNode) {
+ node.owner?.let { owner ->
+ node.dropReferences { it.to == owner && it.kind == RefKind.Owner }
+ owner.dropReferences { it.to == node && it.kind == RefKind.Member }
+ owner.append(groupNode, RefKind.Member)
+ }
+ groupNode.append(node, RefKind.Member)
+ }
+ }
+ }
+
+
fun DocumentationNode.appendOrUpdateMember(descriptor: DeclarationDescriptor) {
if (descriptor.isGenerated() || !descriptor.isDocumented(options)) return
val existingNode = refGraph.lookup(descriptor.signature())
if (existingNode != null) {
+ if (existingNode.kind == NodeKind.TypeAlias && descriptor is ClassDescriptor
+ || existingNode.kind == NodeKind.Class && descriptor is TypeAliasDescriptor) {
+ val node = createGroupNode(descriptor.signature(), listOf(existingNode, descriptor.build()))
+ register(descriptor, node)
+ return
+ }
+
existingNode.updatePlatforms(descriptor)
if (descriptor is ClassDescriptor) {