aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model/documentableUtils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/model/documentableUtils.kt')
-rw-r--r--core/src/main/kotlin/model/documentableUtils.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/src/main/kotlin/model/documentableUtils.kt b/core/src/main/kotlin/model/documentableUtils.kt
new file mode 100644
index 00000000..7f946344
--- /dev/null
+++ b/core/src/main/kotlin/model/documentableUtils.kt
@@ -0,0 +1,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
+ )
+ } \ No newline at end of file