diff options
author | Filip Zybała <fzybala@virtuslab.com> | 2020-03-17 09:30:24 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-25 13:19:31 +0100 |
commit | ba16f209faaf02e3300f2c04fec6c9e5b9ebc152 (patch) | |
tree | 2020e93477be4beacdfadd1917ec75f8b0b66c20 /plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt | |
parent | 9110dbc70e42d10c56d1e080fdaeecd1ea13d84f (diff) | |
download | dokka-ba16f209faaf02e3300f2c04fec6c9e5b9ebc152.tar.gz dokka-ba16f209faaf02e3300f2c04fec6c9e5b9ebc152.tar.bz2 dokka-ba16f209faaf02e3300f2c04fec6c9e5b9ebc152.zip |
Refactored extension method and signature builder. Added indentation to class signature.
Diffstat (limited to 'plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 31cd0eca..8d925376 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -33,7 +33,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog private fun signature(c: DClasslike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) { platformText(c.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " } if (c is DClass) { - if (c.extra[AdditionalModifiers.AdditionalKey]?.content?.contains(ExtraModifiers.DATA) == true) { + if (c.extra[AdditionalModifiers]?.content?.contains(ExtraModifiers.DATA) == true) { text("data ") } else { text(c.modifier.name + " ") @@ -47,15 +47,13 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog is DAnnotation -> text("annotation class ") } link(c.name!!, c.dri) - if(c is Class){ + if(c is DClass){ val pConstructor = c.constructors.singleOrNull() { it.extra[PrimaryConstructorExtra.PrimaryConstructorExtraKey] != null } - if(pConstructor != null) { - list(pConstructor.parameters, "(", ")", ",", pConstructor.platformData.toSet()){ - breakLine() - text(it.name ?: "", styles = mainStyles.plus(TextStyle.Bold)) - text(": ") - signatureForProjection(it.type) - } + list(pConstructor?.parameters.orEmpty(), "(", ")", ",", pConstructor?.platformData.orEmpty().toSet()){ + breakLine() + text(it.name ?: "", styles = mainStyles.plus(TextStyle.Bold).plus(TextStyle.Indented)) + text(": ") + signatureForProjection(it.type) } } if (c is WithSupertypes) { |