From 5a02fd66982b92984f76eaaca16ba6045f55ff31 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Wed, 26 Feb 2020 13:41:31 +0100 Subject: Replace Visibility used in Documentables with custom classes --- core/src/main/kotlin/model/Documentable.kt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'core/src/main/kotlin') diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 9de06ba7..c16f8a87 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -7,7 +7,6 @@ import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.dokka.pages.PlatformData import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.load.kotlin.toSourceElement abstract class Documentable { @@ -65,7 +64,7 @@ interface WithPackages { } interface WithVisibility { - val visibility: PlatformDependent // TODO custom visibility + val visibility: PlatformDependent } interface WithType { @@ -349,6 +348,21 @@ fun Documentable.dfs(predicate: (Documentable) -> Boolean): Documentable? = this.children.asSequence().mapNotNull { it.dfs(predicate) }.firstOrNull() } +sealed class Visibility +sealed class KotlinVisibility : Visibility() { + object Public : KotlinVisibility() + object Private : KotlinVisibility() + object Protected : KotlinVisibility() + object Internal : KotlinVisibility() +} + +sealed class JavaVisibility : Visibility() { + object Public : JavaVisibility() + object Private : JavaVisibility() + object Protected : JavaVisibility() + object Default : JavaVisibility() +} + fun PlatformDependent?.orEmpty(): PlatformDependent = this ?: PlatformDependent.empty() sealed class DocumentableSource(val path: String) -- cgit