aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model/ancestryNode.kt
diff options
context:
space:
mode:
authorAndrzej Ratajczak <32793002+BarkingBad@users.noreply.github.com>2022-02-17 16:27:28 +0100
committerGitHub <noreply@github.com>2022-02-17 18:27:28 +0300
commit9a1434d583b931671e2c5e9c5275af725938d503 (patch)
treed1db2de7c5eb5bde0529c9f8d1a3c47f914fb2af /core/src/main/kotlin/model/ancestryNode.kt
parent13b87181219f5a96e499c6bda230f6bcd2ed3bc0 (diff)
downloaddokka-9a1434d583b931671e2c5e9c5275af725938d503.tar.gz
dokka-9a1434d583b931671e2c5e9c5275af725938d503.tar.bz2
dokka-9a1434d583b931671e2c5e9c5275af725938d503.zip
Refactor Ancestry Graphs (#2326)
Diffstat (limited to 'core/src/main/kotlin/model/ancestryNode.kt')
-rw-r--r--core/src/main/kotlin/model/ancestryNode.kt14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/src/main/kotlin/model/ancestryNode.kt b/core/src/main/kotlin/model/ancestryNode.kt
new file mode 100644
index 00000000..5c3c077b
--- /dev/null
+++ b/core/src/main/kotlin/model/ancestryNode.kt
@@ -0,0 +1,14 @@
+package org.jetbrains.dokka.model
+
+data class AncestryNode(
+ val typeConstructor: TypeConstructor,
+ val superclass: AncestryNode?,
+ val interfaces: List<AncestryNode>,
+) {
+ fun allImplementedInterfaces(): List<TypeConstructor> {
+ fun traverseInterfaces(ancestry: AncestryNode): List<TypeConstructor> =
+ ancestry.interfaces.flatMap { listOf(it.typeConstructor) + traverseInterfaces(it) } +
+ (ancestry.superclass?.let(::traverseInterfaces) ?: emptyList())
+ return traverseInterfaces(this).distinct()
+ }
+}