blob: 7203ab184489a755af37aeee60d604aceccb0571 (
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
public data class AncestryNode(
val typeConstructor: TypeConstructor,
val superclass: AncestryNode?,
val interfaces: List<AncestryNode>,
) {
public 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()
}
}
|