aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2022-04-28 15:20:43 +0300
committerGitHub <noreply@github.com>2022-04-28 15:20:43 +0300
commit4451b8e546584da389da60f73b56ce25d6ac2eaa (patch)
treefe9c2b8772bad7d8970c85c3144bad0803ca00f6 /core/src/main/kotlin/model
parent2e88c6f70feff1edb9f386110a071df897f3b319 (diff)
downloaddokka-4451b8e546584da389da60f73b56ce25d6ac2eaa.tar.gz
dokka-4451b8e546584da389da60f73b56ce25d6ac2eaa.tar.bz2
dokka-4451b8e546584da389da60f73b56ce25d6ac2eaa.zip
Make a default value dependent on source set (#2449)
* Make a default value dependent on source set * Get a default value from an expect source set * Fix default value for expect properties * Deprecate `DefaultValue.value` * Add test * Refactor * Reformat
Diffstat (limited to 'core/src/main/kotlin/model')
-rw-r--r--core/src/main/kotlin/model/defaultValues.kt10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/src/main/kotlin/model/defaultValues.kt b/core/src/main/kotlin/model/defaultValues.kt
index d9caecd9..a118eb4d 100644
--- a/core/src/main/kotlin/model/defaultValues.kt
+++ b/core/src/main/kotlin/model/defaultValues.kt
@@ -3,9 +3,15 @@ package org.jetbrains.dokka.model
import org.jetbrains.dokka.model.properties.ExtraProperty
import org.jetbrains.dokka.model.properties.MergeStrategy
-class DefaultValue(val value: Expression): ExtraProperty<Documentable> {
+class DefaultValue(val expression: SourceSetDependent<Expression>): ExtraProperty<Documentable> {
+
+ @Deprecated("Use `expression` property that depends on source set", ReplaceWith("this.expression.values.first()"))
+ val value: Expression
+ get() = expression.values.first()
companion object : ExtraProperty.Key<Documentable, DefaultValue> {
- override fun mergeStrategyFor(left: DefaultValue, right: DefaultValue): MergeStrategy<Documentable> = MergeStrategy.Remove // TODO pass a logger somehow and log this
+ override fun mergeStrategyFor(left: DefaultValue, right: DefaultValue): MergeStrategy<Documentable> =
+ MergeStrategy.Replace(DefaultValue(left.expression + right.expression))
+
}
override val key: ExtraProperty.Key<Documentable, *>