From 02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Thu, 31 Aug 2023 20:16:01 +0200 Subject: Enable explicit API mode (#3139) --- core/src/main/kotlin/model/WithChildren.kt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'core/src/main/kotlin/model/WithChildren.kt') diff --git a/core/src/main/kotlin/model/WithChildren.kt b/core/src/main/kotlin/model/WithChildren.kt index 01e69fd0..f73a5aa0 100644 --- a/core/src/main/kotlin/model/WithChildren.kt +++ b/core/src/main/kotlin/model/WithChildren.kt @@ -4,39 +4,39 @@ package org.jetbrains.dokka.model -interface WithChildren { - val children: List +public interface WithChildren { + public val children: List } -inline fun WithChildren<*>.firstChildOfTypeOrNull(): T? = +public inline fun WithChildren<*>.firstChildOfTypeOrNull(): T? = children.filterIsInstance().firstOrNull() -inline fun WithChildren<*>.firstChildOfTypeOrNull(predicate: (T) -> Boolean): T? = +public inline fun WithChildren<*>.firstChildOfTypeOrNull(predicate: (T) -> Boolean): T? = children.filterIsInstance().firstOrNull(predicate) -inline fun WithChildren<*>.firstChildOfType(): T = +public inline fun WithChildren<*>.firstChildOfType(): T = children.filterIsInstance().first() -inline fun WithChildren<*>.childrenOfType(): List = +public inline fun WithChildren<*>.childrenOfType(): List = children.filterIsInstance() -inline fun WithChildren<*>.firstChildOfType(predicate: (T) -> Boolean): T = +public inline fun WithChildren<*>.firstChildOfType(predicate: (T) -> Boolean): T = children.filterIsInstance().first(predicate) -inline fun WithChildren>.firstMemberOfType(): T where T : WithChildren<*> { +public inline fun WithChildren>.firstMemberOfType(): T where T : WithChildren<*> { return withDescendants().filterIsInstance().first() } -inline fun WithChildren>.firstMemberOfType( +public inline fun WithChildren>.firstMemberOfType( predicate: (T) -> Boolean ): T where T : WithChildren<*> = withDescendants().filterIsInstance().first(predicate) -inline fun WithChildren>.firstMemberOfTypeOrNull(): T? where T : WithChildren<*> { +public inline fun WithChildren>.firstMemberOfTypeOrNull(): T? where T : WithChildren<*> { return withDescendants().filterIsInstance().firstOrNull() } -fun T.withDescendants(): Sequence where T : WithChildren { +public fun T.withDescendants(): Sequence where T : WithChildren { return sequence { yield(this@withDescendants) children.forEach { child -> @@ -46,7 +46,7 @@ fun T.withDescendants(): Sequence where T : WithChildren { } @JvmName("withDescendantsProjection") -fun WithChildren<*>.withDescendants(): Sequence { +public fun WithChildren<*>.withDescendants(): Sequence { return sequence { yield(this@withDescendants) children.forEach { child -> @@ -58,7 +58,7 @@ fun WithChildren<*>.withDescendants(): Sequence { } @JvmName("withDescendantsAny") -fun WithChildren.withDescendants(): Sequence { +public fun WithChildren.withDescendants(): Sequence { return sequence { yield(this@withDescendants) children.forEach { child -> @@ -69,13 +69,13 @@ fun WithChildren.withDescendants(): Sequence { } } -fun T.dfs(predicate: (T) -> Boolean): T? where T : WithChildren = if (predicate(this)) { +public fun T.dfs(predicate: (T) -> Boolean): T? where T : WithChildren = if (predicate(this)) { this } else { children.asSequence().mapNotNull { it.dfs(predicate) }.firstOrNull() } -fun > T.asPrintableTree( +public fun > T.asPrintableTree( nodeNameBuilder: Appendable.(T) -> Unit = { append(it.toString()) } ): String { fun Appendable.append(element: T, ownPrefix: String, childPrefix: String) { -- cgit