diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-05-28 16:04:20 +0200 |
---|---|---|
committer | Paweł Marks <pmarks@virtuslab.com> | 2020-06-12 14:15:24 +0200 |
commit | d7be30c841cb925fd0d6322ccdd9877169730b92 (patch) | |
tree | 0cc39a4046af6ea203d516c937d26eaf16ef53da /plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt | |
parent | cacc5ec47759c9ea2b8edeec6b39d8d16e6c8860 (diff) | |
download | dokka-d7be30c841cb925fd0d6322ccdd9877169730b92.tar.gz dokka-d7be30c841cb925fd0d6322ccdd9877169730b92.tar.bz2 dokka-d7be30c841cb925fd0d6322ccdd9877169730b92.zip |
Add platform dependent annotations
Diffstat (limited to 'plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index 0ae72109..0cf085b8 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -15,8 +15,8 @@ interface JvmSignatureUtils { fun Set<ExtraModifiers>.toSignatureString(): String = joinToString("") { it.name.toLowerCase() + " " } - fun <T : Documentable> WithExtraProperties<T>.annotations(): List<Annotations.Annotation> = - extra[Annotations]?.content ?: emptyList() + fun <T : Documentable> WithExtraProperties<T>.annotations(): SourceSetDependent<List<Annotations.Annotation>> = + extra[Annotations]?.content ?: emptyMap() private fun Annotations.Annotation.toSignatureString(): String = "@" + this.dri.classNames + "(" + this.params.entries.joinToString { it.key + "=" + it.value } + ")" @@ -24,7 +24,7 @@ interface JvmSignatureUtils { private fun PageContentBuilder.DocumentableContentBuilder.annotations( d: Documentable, ignored: Set<Annotations.Annotation>, - operation: (Annotations.Annotation) -> Unit + operation: PageContentBuilder.DocumentableContentBuilder.(Annotations.Annotation) -> Unit ): Unit = when (d) { is DFunction -> d.annotations() is DProperty -> d.annotations() @@ -39,8 +39,12 @@ interface JvmSignatureUtils { is DParameter -> d.annotations() else -> null }?.let { - it.filter { it !in ignored }.forEach { - operation(it) + it.entries.forEach { + group(sourceSets = setOf(it.key)) { + it.value.filter { it !in ignored }.forEach { + operation(it) + } + } } } ?: Unit @@ -50,6 +54,7 @@ interface JvmSignatureUtils { listBrackets: Pair<Char, Char>, classExtension: String ) { + when (renderAtStrategy) { is All, is OnlyOnce -> text("@") is Never -> Unit |