aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-04-14 15:16:27 +0200
committerGitHub <noreply@github.com>2021-04-14 15:16:27 +0200
commitacd9234be6909a69f89600e9c8ddde642d36b1cf (patch)
tree5494b5c6dbcd74c2cee408659fbcfef6d47def7d /plugins/base/src/main/kotlin
parent357ee8a2836d96204343ff20cab8d17ad2f09aed (diff)
downloaddokka-acd9234be6909a69f89600e9c8ddde642d36b1cf.tar.gz
dokka-acd9234be6909a69f89600e9c8ddde642d36b1cf.tar.bz2
dokka-acd9234be6909a69f89600e9c8ddde642d36b1cf.zip
Fix visibility on enum entry property (#1828)
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt28
1 files changed, 17 insertions, 11 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
index 8ec8c1af..8b3b4304 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
@@ -157,23 +157,26 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
}
}
- private fun filterEnumEntries(entries: List<DEnumEntry>, filteredPlatforms: Set<DokkaSourceSet>) =
- entries.mapNotNull { entry ->
- if (filteredPlatforms.containsAll(entry.sourceSets)) entry
+ private fun filterEnumEntries(entries: List<DEnumEntry>, filteredPlatforms: Set<DokkaSourceSet>): Pair<Boolean, List<DEnumEntry>> =
+ entries.foldRight(Pair(false, emptyList())) { entry, acc ->
+ val intersection = filteredPlatforms.intersect(entry.sourceSets)
+ if (intersection.isEmpty()) Pair(true, acc.second)
else {
- val intersection = filteredPlatforms.intersect(entry.sourceSets)
- if (intersection.isEmpty()) null
- else DEnumEntry(
+ val functions = filterFunctions(entry.functions) { _, data -> data in intersection }
+ val properties = filterProperties(entry.properties) { _, data -> data in intersection }
+ val classlikes = filterClasslikes(entry.classlikes) { _, data -> data in intersection }
+
+ DEnumEntry(
entry.dri,
entry.name,
entry.documentation.filtered(intersection),
entry.expectPresentInSet.filtered(filteredPlatforms),
- filterFunctions(entry.functions) { _, data -> data in intersection }.second,
- filterProperties(entry.properties) { _, data -> data in intersection }.second,
- filterClasslikes(entry.classlikes) { _, data -> data in intersection }.second,
+ functions.second,
+ properties.second,
+ classlikes.second,
intersection,
entry.extra
- )
+ ).let { Pair(functions.first || properties.first || classlikes.first, acc.second + it) }
}
}
@@ -218,7 +221,10 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
val generics =
if (this is WithGenerics) generics.mapNotNull { param -> param.filter(filteredPlatforms) } else emptyList()
val enumEntries =
- if (this is DEnum) filterEnumEntries(entries, filteredPlatforms) else emptyList()
+ if (this is DEnum) filterEnumEntries(entries, filteredPlatforms).let { (listModified, list) ->
+ modified = modified || listModified
+ list
+ } else emptyList()
classlikesListChanged = classlikesListChanged || modified
when {
!modified -> this