aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model/documentableUtils.kt
blob: b09260ee0aff3784594f2d5bfeecbb25163c8e8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package org.jetbrains.dokka.model

fun <T> SourceSetDependent<T>.filtered(platformDataList: List<SourceSetData>) = filter { it.key in platformDataList }
fun SourceSetData?.filtered(platformDataList: List<SourceSetData>) = takeIf { this in platformDataList }

fun DTypeParameter.filter(filteredData: List<SourceSetData>) =
    if (filteredData.containsAll(sourceSets)) this
    else {
        val intersection = filteredData.intersect(sourceSets).toList()
        if (intersection.isEmpty()) null
        else DTypeParameter(
            dri,
            name,
            documentation.filtered(intersection),
            expectPresentInSet?.takeIf { intersection.contains(expectPresentInSet) },
            bounds,
            intersection,
            extra
        )
    }