aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorGoooler <wangzongler@gmail.com>2022-02-15 17:38:10 +0800
committerGitHub <noreply@github.com>2022-02-15 12:38:10 +0300
commit2372302f4bc3b4bf49beb0d477eebdd9ac99a78f (patch)
tree3a984a8ecdd63da74dfd48a777cc56200ee1d666 /core/src/main/kotlin/transformers
parentb0244f69277f492eb87694cf34cc620a265adbcb (diff)
downloaddokka-2372302f4bc3b4bf49beb0d477eebdd9ac99a78f.tar.gz
dokka-2372302f4bc3b4bf49beb0d477eebdd9ac99a78f.tar.bz2
dokka-2372302f4bc3b4bf49beb0d477eebdd9ac99a78f.zip
Convert interfaces to functional (#2360)
Diffstat (limited to 'core/src/main/kotlin/transformers')
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt2
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt2
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt2
-rw-r--r--core/src/main/kotlin/transformers/pages/PageTransformer.kt2
-rw-r--r--core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt12
-rw-r--r--core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt2
6 files changed, 8 insertions, 14 deletions
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt b/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
index aa878873..358fdb1d 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
@@ -3,6 +3,6 @@ package org.jetbrains.dokka.transformers.documentation
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
-interface DocumentableMerger {
+fun interface DocumentableMerger {
operator fun invoke(modules: Collection<DModule>): DModule?
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
index a4daba63..f8005cfe 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
@@ -4,6 +4,6 @@ import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
import org.jetbrains.dokka.pages.RootPageNode
-interface DocumentableToPageTranslator {
+fun interface DocumentableToPageTranslator {
operator fun invoke(module: DModule): RootPageNode
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
index d0570c7a..a808a224 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
@@ -4,6 +4,6 @@ import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.plugability.DokkaContext
-interface DocumentableTransformer {
+fun interface DocumentableTransformer {
operator fun invoke(original: DModule, context: DokkaContext): DModule
}
diff --git a/core/src/main/kotlin/transformers/pages/PageTransformer.kt b/core/src/main/kotlin/transformers/pages/PageTransformer.kt
index 68dc4bc8..b51eb31b 100644
--- a/core/src/main/kotlin/transformers/pages/PageTransformer.kt
+++ b/core/src/main/kotlin/transformers/pages/PageTransformer.kt
@@ -2,6 +2,6 @@ package org.jetbrains.dokka.transformers.pages
import org.jetbrains.dokka.pages.RootPageNode
-interface PageTransformer {
+fun interface PageTransformer {
operator fun invoke(input: RootPageNode): RootPageNode
}
diff --git a/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt b/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt
index 291b72ef..6797eae6 100644
--- a/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt
+++ b/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt
@@ -3,17 +3,11 @@ package org.jetbrains.dokka.transformers.pages
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RootPageNode
-fun pageScanner(block: PageNode.() -> Unit) = object : PageTransformer {
- override fun invoke(input: RootPageNode): RootPageNode = input.invokeOnAll(block) as RootPageNode
-}
+fun pageScanner(block: PageNode.() -> Unit) = PageTransformer { input -> input.invokeOnAll(block) as RootPageNode }
-fun pageMapper(block: PageNode.() -> PageNode) = object : PageTransformer {
- override fun invoke(input: RootPageNode): RootPageNode = input.alterChildren(block) as RootPageNode
-}
+fun pageMapper(block: PageNode.() -> PageNode) = PageTransformer { input -> input.alterChildren(block) as RootPageNode }
-fun pageStructureTransformer(block: RootPageNode.() -> RootPageNode) = object : PageTransformer {
- override fun invoke(input: RootPageNode): RootPageNode = block(input)
-}
+fun pageStructureTransformer(block: RootPageNode.() -> RootPageNode) = PageTransformer { input -> block(input) }
fun PageNode.invokeOnAll(block: PageNode.() -> Unit): PageNode =
this.also(block).also { it.children.forEach { it.invokeOnAll(block) } }
diff --git a/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt
index 2252dde3..2f0ea031 100644
--- a/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt
+++ b/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt
@@ -4,6 +4,6 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
-interface SourceToDocumentableTranslator {
+fun interface SourceToDocumentableTranslator {
fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule
}