diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-09-24 21:52:22 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-09-24 21:52:22 +0300 |
commit | 49b7b776757113139fb7aed9c8959276d844b09b (patch) | |
tree | 1c41169af79b3910116e01eaeb7f7ffc0fb2e9b5 /core | |
parent | d7fdbb7b4ab13d05bbc8ea796518e75ecab97fb7 (diff) | |
download | dokka-49b7b776757113139fb7aed9c8959276d844b09b.tar.gz dokka-49b7b776757113139fb7aed9c8959276d844b09b.tar.bz2 dokka-49b7b776757113139fb7aed9c8959276d844b09b.zip |
Get rid of duplicated items with set of platform < than common
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/Generation/DocumentationMerger.kt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Generation/DocumentationMerger.kt b/core/src/main/kotlin/Generation/DocumentationMerger.kt index 3be6be83..f6280fb9 100644 --- a/core/src/main/kotlin/Generation/DocumentationMerger.kt +++ b/core/src/main/kotlin/Generation/DocumentationMerger.kt @@ -120,11 +120,20 @@ class DocumentationMerger( signature: String, nodes: List<DocumentationNode> ): DocumentationNode { + require(nodes.isNotEmpty()) + val singleNode = nodes.singleOrNull() if (singleNode != null) { singleNode.dropReferences { it.kind == RefKind.Owner } return singleNode } + val nodeWithMaxPlatforms = nodes.maxBy { it.platforms.size }!! + val maxPlatforms = nodeWithMaxPlatforms.platforms.toSet() + val notContained = nodes.filterNot { maxPlatforms.containsAll(it.platforms) } + val reducedDuplicates = notContained + nodeWithMaxPlatforms + if (!reducedDuplicates.containsAll(nodes)) { + return mergeMembersWithEqualSignature(signature, reducedDuplicates) + } val groupNode = DocumentationNode(nodes.first().name, Content.Empty, NodeKind.GroupNode) groupNode.appendTextNode(signature, NodeKind.Signature, RefKind.Detail) |