aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-06-22 03:37:15 +0200
committerPaweł Marks <pmarks@virtuslab.com>2020-06-26 00:40:47 +0200
commitfb9a5abfc24e93b918693f78a8f555da2c5a359f (patch)
tree5769bf9d8b504476085a142eaccc9c8353421933 /core
parent370bf45d2dca5fcd71f53c71386be8667157c446 (diff)
downloaddokka-fb9a5abfc24e93b918693f78a8f555da2c5a359f.tar.gz
dokka-fb9a5abfc24e93b918693f78a8f555da2c5a359f.tar.bz2
dokka-fb9a5abfc24e93b918693f78a8f555da2c5a359f.zip
Javadoc briefs update
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/model/doc/DocTag.kt5
-rw-r--r--core/src/main/kotlin/model/doc/DocumentationNode.kt4
-rw-r--r--core/src/main/kotlin/model/doc/TagWrapper.kt6
-rw-r--r--core/src/main/kotlin/model/documentableUtils.kt12
4 files changed, 22 insertions, 5 deletions
diff --git a/core/src/main/kotlin/model/doc/DocTag.kt b/core/src/main/kotlin/model/doc/DocTag.kt
index 812acd62..902dedec 100644
--- a/core/src/main/kotlin/model/doc/DocTag.kt
+++ b/core/src/main/kotlin/model/doc/DocTag.kt
@@ -1,11 +1,12 @@
package org.jetbrains.dokka.model.doc
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.model.WithChildren
sealed class DocTag(
- val children: List<DocTag>,
+ override val children: List<DocTag>,
val params: Map<String, String>
-) {
+) : WithChildren {
override fun equals(other: Any?): Boolean =
(
other != null &&
diff --git a/core/src/main/kotlin/model/doc/DocumentationNode.kt b/core/src/main/kotlin/model/doc/DocumentationNode.kt
index a143a941..cfac210a 100644
--- a/core/src/main/kotlin/model/doc/DocumentationNode.kt
+++ b/core/src/main/kotlin/model/doc/DocumentationNode.kt
@@ -1,3 +1,5 @@
package org.jetbrains.dokka.model.doc
-data class DocumentationNode(val children: List<TagWrapper>) \ No newline at end of file
+import org.jetbrains.dokka.model.WithChildren
+
+data class DocumentationNode(override val children: List<TagWrapper>): WithChildren \ No newline at end of file
diff --git a/core/src/main/kotlin/model/doc/TagWrapper.kt b/core/src/main/kotlin/model/doc/TagWrapper.kt
index af45e7eb..458203b0 100644
--- a/core/src/main/kotlin/model/doc/TagWrapper.kt
+++ b/core/src/main/kotlin/model/doc/TagWrapper.kt
@@ -1,8 +1,12 @@
package org.jetbrains.dokka.model.doc
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.model.WithChildren
-sealed class TagWrapper(val root: DocTag) {
+sealed class TagWrapper(val root: DocTag) : WithChildren {
+
+ override val children: List<DocTag>
+ get() = root.children
override fun equals(other: Any?): Boolean =
(
diff --git a/core/src/main/kotlin/model/documentableUtils.kt b/core/src/main/kotlin/model/documentableUtils.kt
index 7057a62c..f49c0967 100644
--- a/core/src/main/kotlin/model/documentableUtils.kt
+++ b/core/src/main/kotlin/model/documentableUtils.kt
@@ -19,4 +19,14 @@ fun DTypeParameter.filter(filteredSet: Set<DokkaSourceSet>) =
intersection,
extra
)
- } \ No newline at end of file
+ }
+
+interface WithChildren {
+ val children: List<*>
+}
+
+inline fun <reified T> WithChildren.firstChildOfType() =
+ children.filterIsInstance<T>().firstOrNull()
+
+inline fun <reified T> WithChildren.firstChildOfType(predicate: (T) -> Boolean) =
+ children.filterIsInstance<T>().firstOrNull(predicate) \ No newline at end of file