diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-09-30 14:57:10 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-10-02 14:12:05 +0200 |
commit | 249556460973007de3d436ddda1df7d100aefab0 (patch) | |
tree | 5b5e05f761927f69488c80cf195643cbdae09c33 /plugins/base/src/main/kotlin | |
parent | 8de5296b18083361055d11acf6d522c1eef821a4 (diff) | |
download | dokka-249556460973007de3d436ddda1df7d100aefab0.tar.gz dokka-249556460973007de3d436ddda1df7d100aefab0.tar.bz2 dokka-249556460973007de3d436ddda1df7d100aefab0.zip |
Fix typealiases filtering when private
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt index 9b024a0b..57faeefb 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt @@ -57,6 +57,10 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe modified = modified || listModified list } + val typeAliases = filterTypeAliases(it.typealiases).let { (listModified, list) -> + modified = modified || listModified + list + } when { !modified -> it else -> { @@ -66,7 +70,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe functions, properties, classlikes, - it.typealiases, + typeAliases, it.documentation, it.expectPresentInSet, it.sourceSets, @@ -290,5 +294,22 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe } return Pair(classlikesListChanged, filteredClasslikes) } + + private fun filterTypeAliases( + typeAliases: List<DTypeAlias>, + additionalCondition: (DTypeAlias, DokkaSourceSet) -> Boolean = ::alwaysTrue + ) = + typeAliases.transform(additionalCondition) { original, filteredPlatforms -> + with(original) { + copy( + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + underlyingType = underlyingType.filtered(filteredPlatforms), + visibility = visibility.filtered(filteredPlatforms), + generics = generics.mapNotNull { it.filter(filteredPlatforms) }, + sourceSets = filteredPlatforms, + ) + } + } } } |