aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-02-21 15:52:38 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-02-27 10:51:51 +0100
commit2308016b143cf8c0c5f216f7eb5975b77ef552a5 (patch)
tree949388ed2902dddf263e05372bca4f368a093035 /core/src
parentb62126328f0778abe21d3334f5a713086cb3d15e (diff)
downloaddokka-2308016b143cf8c0c5f216f7eb5975b77ef552a5.tar.gz
dokka-2308016b143cf8c0c5f216f7eb5975b77ef552a5.tar.bz2
dokka-2308016b143cf8c0c5f216f7eb5975b77ef552a5.zip
Fix descriptor to documentable translator
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/model/Documentable.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
index 73a5f9d3..337bddc5 100644
--- a/core/src/main/kotlin/model/Documentable.kt
+++ b/core/src/main/kotlin/model/Documentable.kt
@@ -47,7 +47,8 @@ data class PlatformDependent<out T>(
get() = map.values.distinct().singleOrNull()
companion object {
- fun <T> empty() = PlatformDependent(mapOf<PlatformData, T>())
+ fun <T> empty(): PlatformDependent<T> = PlatformDependent(emptyMap())
+ fun <T> from(platformData: PlatformData, element: T) = PlatformDependent(mapOf(platformData to element))
}
}
@@ -77,7 +78,7 @@ interface WithAbstraction {
val modifier: Modifier?
enum class Modifier {
- Abstract, Open, Final, Static
+ Abstract, Open, Final, Sealed, Empty
}
}
@@ -345,6 +346,7 @@ fun Documentable.dfs(predicate: (Documentable) -> Boolean): Documentable? =
this.children.asSequence().mapNotNull { it.dfs(predicate) }.firstOrNull()
}
+fun <T> PlatformDependent<T>?.orEmpty(): PlatformDependent<T> = this ?: PlatformDependent.empty()
sealed class DocumentableSource(val path: String)
class DescriptorDocumentableSource(val descriptor: DeclarationDescriptor) :