blob: da469eecbd75a14d6391cafc7122cf87fd539a6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/*
* Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
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()
}
}
|