diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-02-28 16:58:22 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-02-28 16:58:22 +0300 |
commit | ddad0ac478f31ca0b74de43af4254f115f694ef7 (patch) | |
tree | 958628cb8388dc5c2f718b22f6d9210fce28beb2 /core/src/main/kotlin | |
parent | 6276fd0e68085c9b0994f8f947bf904b9b285b34 (diff) | |
download | dokka-ddad0ac478f31ca0b74de43af4254f115f694ef7.tar.gz dokka-ddad0ac478f31ca0b74de43af4254f115f694ef7.tar.bz2 dokka-ddad0ac478f31ca0b74de43af4254f115f694ef7.zip |
Correct detecting platform for Extensions on external classes
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r-- | core/src/main/kotlin/Formats/StructuredFormatService.kt | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index a7b696eb..419e5eeb 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -368,11 +368,19 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } - protected fun platformsOfItems(items: List<DocumentationNode>): Set<String> = - items.foldRight(items.first().platformsToShow.toSet()) { - node, platforms -> - platforms.intersect(node.platformsToShow) + protected fun platformsOfItems(items: List<DocumentationNode>): Set<String> { + val platforms = items.asSequence().map { + when (it.kind) { + NodeKind.ExternalClass, NodeKind.Package, NodeKind.Module -> platformsOfItems(it.members) + else -> it.platformsToShow.toSet() } + } + // Calculating common platforms for items + return platforms.fold(platforms.first()) { + result, platforms -> + result.intersect(platforms) + } + } val DocumentationNode.platformsToShow: List<String> get() = platforms.let { if (it.containsAll(impliedPlatforms)) it - impliedPlatforms else it } @@ -498,7 +506,9 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, appendIndexRow(platforms) { appendTableCell { appendLink(memberLocation) - appendPlatforms(platforms) + if (members.singleOrNull()?.kind != NodeKind.ExternalClass) { + appendPlatforms(platforms) + } } appendTableCell { val breakdownBySummary = members.groupBy { it.summary } |