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

import org.jetbrains.dokka.pages.PlatformData

fun <T> PlatformDependent<T>.filtered(platformDataList: List<PlatformData>) = PlatformDependent(
    map.filter { it.key in platformDataList },
    expect
)

fun DTypeParameter.filter(filteredData: List<PlatformData>) =
    if (filteredData.containsAll(platformData)) this
    else {
        val intersection = filteredData.intersect(platformData).toList()
        if (intersection.isEmpty()) null
        else DTypeParameter(
            dri,
            name,
            documentation.filtered(intersection),
            bounds,
            intersection,
            extra
        )
    }