aboutsummaryrefslogtreecommitdiff
path: root/core
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
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')
-rw-r--r--core/api/core.api3
-rw-r--r--core/src/main/kotlin/model/defaultValues.kt10
2 files changed, 10 insertions, 3 deletions
diff --git a/core/api/core.api b/core/api/core.api
index 74b4b422..8add4bd8 100644
--- a/core/api/core.api
+++ b/core/api/core.api
@@ -1385,7 +1385,8 @@ public final class org/jetbrains/dokka/model/DTypeParameter : org/jetbrains/dokk
public final class org/jetbrains/dokka/model/DefaultValue : org/jetbrains/dokka/model/properties/ExtraProperty {
public static final field Companion Lorg/jetbrains/dokka/model/DefaultValue$Companion;
- public fun <init> (Lorg/jetbrains/dokka/model/Expression;)V
+ public fun <init> (Ljava/util/Map;)V
+ public final fun getExpression ()Ljava/util/Map;
public fun getKey ()Lorg/jetbrains/dokka/model/properties/ExtraProperty$Key;
public final fun getValue ()Lorg/jetbrains/dokka/model/Expression;
}
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, *>