diff options
author | Goooler <wangzongler@gmail.com> | 2022-02-21 22:01:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 17:01:06 +0300 |
commit | f5b7797255576e5f1c230e2ca3fcb5f4e602387c (patch) | |
tree | 25fd98250066c4ed6c2fff1104be533604bbf1b9 /plugins/base/src/main/kotlin/transformers/documentables | |
parent | df4780c31026aaa626746f49f0e6fa3fa0278a05 (diff) | |
download | dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.tar.gz dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.tar.bz2 dokka-f5b7797255576e5f1c230e2ca3fcb5f4e602387c.zip |
Code cleanups (#2165)
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers/documentables')
3 files changed, 3 insertions, 5 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt index 61a7a6a2..6239ad6b 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt @@ -34,7 +34,7 @@ internal class DefaultDocumentableMerger(val context: DokkaContext) : Documentab it.sourceSetID in sourceSet.dependentSourceSets }.flatMap { getDependencies(it) } - return configuration.sourceSets.map { it to getDependencies(it) }.toMap() + return configuration.sourceSets.associateWith { getDependencies(it) } } private fun <T : Documentable> merge(elements: List<T>, reducer: (T, T) -> T): List<T> = @@ -104,8 +104,7 @@ internal class DefaultDocumentableMerger(val context: DokkaContext) : Documentab } val reducedToOneDocumentableWithActualSourceSetIds = groupedByOwnExpectWithActualSourceSetIds.map { it.first.reduce(reducer) to it.second } - val uniqueNamedDocumentables = reducedToOneDocumentableWithActualSourceSetIds.let(::mergeClashingElements) - return uniqueNamedDocumentables + return reducedToOneDocumentableWithActualSourceSetIds.let(::mergeClashingElements) } diff --git a/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt index 181113ae..463ec419 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt @@ -49,7 +49,7 @@ class InheritorsExtractorTransformer : DocumentableTransformer { private fun Map<DokkaSourceSet, Map<DRI, List<DRI>>>.getForDRI(dri: DRI) = map { (v, k) -> v to k[dri] - }.map { (k, v) -> k to v.orEmpty() }.toMap() + }.associate { (k, v) -> k to v.orEmpty() } private fun DModule.generateInheritanceMap() = getInheritanceEntriesRec().filterNot { it.second.isEmpty() }.groupBy({ it.first }) { it.second } diff --git a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt index 961d2aca..2a5fbc11 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt @@ -3,7 +3,6 @@ package org.jetbrains.dokka.base.transformers.documentables import org.jetbrains.dokka.model.Annotations import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.ExceptionInSupertypes -import org.jetbrains.dokka.model.WithSupertypes import org.jetbrains.dokka.model.properties.WithExtraProperties fun <T> T.isDeprecated() where T : WithExtraProperties<out Documentable> = |