aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-02-26 13:41:31 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-03-04 13:39:48 +0100
commit5a02fd66982b92984f76eaaca16ba6045f55ff31 (patch)
treed2e8820cf4066aef813ec74b1aeb14cbe264e7e8 /core
parentbc55869d707e5abafbf8544b5f519e003a504ac6 (diff)
downloaddokka-5a02fd66982b92984f76eaaca16ba6045f55ff31.tar.gz
dokka-5a02fd66982b92984f76eaaca16ba6045f55ff31.tar.bz2
dokka-5a02fd66982b92984f76eaaca16ba6045f55ff31.zip
Replace Visibility used in Documentables with custom classes
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/model/Documentable.kt18
1 files changed, 16 insertions, 2 deletions
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<Visibility> // TODO custom visibility
+ val visibility: PlatformDependent<Visibility>
}
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 <T> PlatformDependent<T>?.orEmpty(): PlatformDependent<T> = this ?: PlatformDependent.empty()
sealed class DocumentableSource(val path: String)