diff options
author | Filip Zybała <fzybala@virtuslab.com> | 2020-03-24 12:38:22 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-26 12:36:03 +0100 |
commit | fe232a3f41978f83134f486ed55dad49bfcb0caa (patch) | |
tree | afda20effb1be76081ebc482e747c8b6267eb993 | |
parent | 8a87b5e0bd2eda12f4e44512e3f8856c72e53b3e (diff) | |
download | dokka-fe232a3f41978f83134f486ed55dad49bfcb0caa.tar.gz dokka-fe232a3f41978f83134f486ed55dad49bfcb0caa.tar.bz2 dokka-fe232a3f41978f83134f486ed55dad49bfcb0caa.zip |
Signatures are now platform-hinted. Fixed merger after changing modifier to PlatformDependent.
3 files changed, 29 insertions, 28 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index d87152d5..f59a41a1 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -71,7 +71,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog private fun signature(f: DFunction) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) { platformText(f.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " } - platformText(f.modifier) { it.name } + platformText(f.modifier) { it.name + " " } text("fun ") list(f.generics, prefix = "<", suffix = "> ") { +buildSignature(it) diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt index 48be8ae7..c87b5de3 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt @@ -120,6 +120,7 @@ fun DFunction.mergeWith(other: DFunction): DFunction = copy( documentation = documentation.mergeWith(other.documentation), sources = sources.mergeWith(other.sources), visibility = visibility.mergeWith(other.visibility), + modifier = modifier.mergeWith(other.modifier), platformData = (platformData + other.platformData).distinct(), generics = merge(generics + other.generics, DTypeParameter::mergeWith) ).mergeExtras(this, other) @@ -129,6 +130,7 @@ fun DProperty.mergeWith(other: DProperty): DProperty = copy( documentation = documentation.mergeWith(other.documentation), sources = sources.mergeWith(other.sources), visibility = visibility.mergeWith(other.visibility), + modifier = modifier.mergeWith(other.modifier), platformData = (platformData + other.platformData).distinct(), getter = getter?.let { g -> other.getter?.let { g.mergeWith(it) } ?: g } ?: other.getter, setter = setter?.let { s -> other.setter?.let { s.mergeWith(it) } ?: s } ?: other.setter @@ -161,6 +163,7 @@ fun DClass.mergeWith(other: DClass): DClass = copy( classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData), companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion, generics = merge(generics + other.generics, DTypeParameter::mergeWith), + modifier = modifier.mergeWith(other.modifier), supertypes = supertypes.mergeWith(other.supertypes), documentation = documentation.mergeWith(other.documentation), sources = sources.mergeWith(other.sources), diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index b9e02398..da30cf6f 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -43,11 +43,9 @@ open class DefaultPageCreator( open fun pageForFunction(f: DFunction) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f) protected open fun contentForModule(m: DModule) = contentBuilder.contentFor(m) { - platformDependentHint(m.dri, m.platformData.toSet()){ - header(1) { text(m.name) } - block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) { + header(1) { text(m.name) } + block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) { link(it.name, it.dri) - } } // text("Index\n") TODO // text("Link to allpage here") @@ -55,9 +53,7 @@ open class DefaultPageCreator( protected open fun contentForPackage(p: DPackage) = contentBuilder.contentFor(p) { header(1) { text("Package ${p.name}") } - platformDependentHint(p.dri, p.platformData.toSet()){ - +contentForScope(p, p.dri, p.platformData) - } + +contentForScope(p, p.dri, p.platformData) } protected open fun contentForScope( @@ -67,33 +63,33 @@ open class DefaultPageCreator( ) = contentBuilder.contentFor(s as Documentable) { block("Types", 2, ContentKind.Classlikes, s.classlikes, platformData.toSet()) { link(it.name.orEmpty(), it.dri) - platformDependentHint(it.dri, it.platformData.toSet()){ - group { + group { + platformDependentHint(it.dri, it.platformData.toSet()) { +buildSignature(it) - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) - } + } + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) } } } block("Functions", 2, ContentKind.Functions, s.functions, platformData.toSet()) { link(it.name, it.dri) - platformDependentHint(it.dri, it.platformData.toSet()){ - group { + group { + platformDependentHint(it.dri, it.platformData.toSet()) { +buildSignature(it) - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) - } + } + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) } } } block("Properties", 2, ContentKind.Properties, s.properties, platformData.toSet()) { link(it.name, it.dri) - platformDependentHint(it.dri, it.platformData.toSet()){ + platformDependentHint(it.dri, it.platformData.toSet()) { +buildSignature(it) - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) - } + } + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) } } (s as? WithExtraProperties<Documentable>)?.let { it.extra[InheritorsInfo] }?.let { inheritors -> @@ -109,7 +105,9 @@ open class DefaultPageCreator( protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) { header(1) { text(c.name.orEmpty()) } - +buildSignature(c) + platformDependentHint(c.dri, c.platformData.toSet()) { + +buildSignature(c) + } breakLine() +contentForComments(c) { it !is Property } @@ -123,8 +121,9 @@ open class DefaultPageCreator( ) { link(it.name, it.dri) group { - +buildSignature(it) - + platformDependentHint(it.dri, it.platformData.toSet()) { + +buildSignature(it) + } group(kind = ContentKind.BriefComment) { text(it.briefDocumentation()) } @@ -165,11 +164,10 @@ open class DefaultPageCreator( protected open fun contentForFunction(f: DFunction) = contentBuilder.contentFor(f) { header(1) { text(f.name) } - platformDependentHint(f.dri, f.platformData.toSet()){ - if(f.sources.expect != null) text("actual") + platformDependentHint(f.dri, f.platformData.toSet()) { +buildSignature(f) - +contentForComments(f) } + +contentForComments(f) } protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last() |