diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-08-31 13:27:43 +0200 |
---|---|---|
committer | Andrzej Ratajczak <32793002+BarkingBad@users.noreply.github.com> | 2020-09-08 12:52:59 +0200 |
commit | 883408f0d12abfba88434b41cd8d752afc7ebf35 (patch) | |
tree | ec693ce8e071fe7defa3cd760c5e7234697e59a2 /plugins/base/src/main | |
parent | 956e5ff3b21290d536b45f2a185f419416eb5554 (diff) | |
download | dokka-883408f0d12abfba88434b41cd8d752afc7ebf35.tar.gz dokka-883408f0d12abfba88434b41cd8d752afc7ebf35.tar.bz2 dokka-883408f0d12abfba88434b41cd8d752afc7ebf35.zip |
Apply requested changes
Diffstat (limited to 'plugins/base/src/main')
9 files changed, 149 insertions, 238 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt b/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt index 1b65fc22..1fb7b960 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt @@ -62,7 +62,7 @@ class ActualTypealiasAdder : DocumentableTransformer { private fun <T> addActualTypeAlias( elements: Iterable<T>, typealiases: Map<DRI, DTypeAlias> - ): List<T> where T : DClasslike, T : WithExtraProperties<T>, T : WithExpectActual = + ): List<T> where T : DClasslike, T : WithExtraProperties<T>, T : WithSources = elements.map { element -> if (element.expectPresentInSet != null) { typealiases[element.dri]?.let { ta -> @@ -81,4 +81,4 @@ class ActualTypealiasAdder : DocumentableTransformer { element } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt index 6e288c01..a7cd171e 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt @@ -79,10 +79,7 @@ internal class DefaultDocumentableMerger(val context: DokkaContext) : Documentab private fun <T> mergeExpectActual( elements: List<T>, reducer: (T, T) -> T - ): List<T> where T : Documentable, T : WithExpectActual { - - fun T.isExpectActual(): Boolean = - this.safeAs<WithExtraProperties<T>>().let { it != null && it.extra[IsExpectActual] != null } + ): List<T> where T : Documentable, T : WithSources { fun mergeClashingElements(elements: List<Pair<T, Set<DokkaConfiguration.DokkaSourceSet>>>): List<T> = elements.groupBy { it.first.name }.values.flatMap { listOfDocumentableToSSIds -> @@ -147,7 +144,7 @@ internal class DefaultDocumentableMerger(val context: DokkaContext) : Documentab return elements.partition { - it.isExpectActual() + (it as? WithIsExpectActual)?.isExpectActual ?: false }.let { (expectActuals, notExpectActuals) -> notExpectActuals.map { it to it.sourceSets } .groupBy { it.first.dri }.values.flatMap(::mergeClashingElements) + diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt index 6a6231c5..aab7c6ba 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt @@ -35,12 +35,8 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe filterPackages(original.packages).let { (modified, packages) -> if (!modified) original else - DModule( - original.name, - packages = packages, - documentation = original.documentation, - sourceSets = original.sourceSets, - extra = original.extra + original.copy( + packages = packages ) } @@ -65,16 +61,10 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe !modified -> pckg else -> { packagesListChanged = true - DPackage( - pckg.dri, - functions, - properties, - classlikes, - pckg.typealiases, - pckg.documentation, - pckg.expectPresentInSet, - pckg.sourceSets, - pckg.extra + pckg.copy( + functions = functions, + properties = properties, + classlikes = classlikes ) } } @@ -98,16 +88,10 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe private fun filterEnumEntries(entries: List<DEnumEntry>) = entries.filter { it.isAllowedInPackage() }.map { entry -> - DEnumEntry( - entry.dri, - entry.name, - entry.documentation, - entry.expectPresentInSet, - filterFunctions(entry.functions).second, - filterProperties(entry.properties).second, - filterClasslikes(entry.classlikes).second, - entry.sourceSets, - entry.extra + entry.copy( + functions = filterFunctions(entry.functions).second, + properties = filterProperties(entry.properties).second, + classlikes = filterClasslikes(entry.classlikes).second, ) } @@ -125,122 +109,70 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe } }.map { classlike -> fun helper(): DClasslike = when (classlike) { - is DClass -> DClass( - classlike.dri, - classlike.name, - filterFunctions(classlike.constructors).let { + is DClass -> classlike.copy( + constructors = filterFunctions(classlike.constructors).let { modified = modified || it.first; it.second }, - filterFunctions(classlike.functions).let { + functions = filterFunctions(classlike.functions).let { modified = modified || it.first; it.second }, - filterProperties(classlike.properties).let { + properties = filterProperties(classlike.properties).let { modified = modified || it.first; it.second }, - filterClasslikes(classlike.classlikes).let { + classlikes = filterClasslikes(classlike.classlikes).let { modified = modified || it.first; it.second - }, - classlike.sources, - classlike.visibility, - classlike.companion, - classlike.generics, - classlike.supertypes, - classlike.documentation, - classlike.expectPresentInSet, - classlike.modifier, - classlike.sourceSets, - classlike.extra + } ) - is DAnnotation -> DAnnotation( - classlike.name, - classlike.dri, - classlike.documentation, - classlike.expectPresentInSet, - classlike.sources, - filterFunctions(classlike.functions).let { + is DAnnotation -> classlike.copy( + functions = filterFunctions(classlike.functions).let { modified = modified || it.first; it.second }, - filterProperties(classlike.properties).let { + properties = filterProperties(classlike.properties).let { modified = modified || it.first; it.second }, - filterClasslikes(classlike.classlikes).let { + classlikes = filterClasslikes(classlike.classlikes).let { modified = modified || it.first; it.second }, - classlike.visibility, - classlike.companion, - filterFunctions(classlike.constructors).let { + constructors = filterFunctions(classlike.constructors).let { modified = modified || it.first; it.second - }, - classlike.generics, - classlike.sourceSets, - classlike.extra + } ) - is DEnum -> DEnum( - classlike.dri, - classlike.name, - filterEnumEntries(classlike.entries), - classlike.documentation, - classlike.expectPresentInSet, - classlike.sources, - filterFunctions(classlike.functions).let { + is DEnum -> classlike.copy( + entries = filterEnumEntries(classlike.entries), + functions = filterFunctions(classlike.functions).let { modified = modified || it.first; it.second }, - filterProperties(classlike.properties).let { + properties = filterProperties(classlike.properties).let { modified = modified || it.first; it.second }, - filterClasslikes(classlike.classlikes).let { + classlikes = filterClasslikes(classlike.classlikes).let { modified = modified || it.first; it.second }, - classlike.visibility, - classlike.companion, - filterFunctions(classlike.constructors).let { + constructors = filterFunctions(classlike.constructors).let { modified = modified || it.first; it.second }, - classlike.supertypes, - classlike.sourceSets, - classlike.extra ) - is DInterface -> DInterface( - classlike.dri, - classlike.name, - classlike.documentation, - classlike.expectPresentInSet, - classlike.sources, - filterFunctions(classlike.functions).let { + is DInterface -> classlike.copy( + functions = filterFunctions(classlike.functions).let { modified = modified || it.first; it.second }, - filterProperties(classlike.properties).let { + properties = filterProperties(classlike.properties).let { modified = modified || it.first; it.second }, - filterClasslikes(classlike.classlikes).let { + classlikes = filterClasslikes(classlike.classlikes).let { modified = modified || it.first; it.second - }, - classlike.visibility, - classlike.companion, - classlike.generics, - classlike.supertypes, - classlike.sourceSets, - classlike.extra + } ) - is DObject -> DObject( - classlike.name, - classlike.dri, - classlike.documentation, - classlike.expectPresentInSet, - classlike.sources, - filterFunctions(classlike.functions).let { + is DObject -> classlike.copy( + functions = filterFunctions(classlike.functions).let { modified = modified || it.first; it.second }, - filterProperties(classlike.properties).let { + properties = filterProperties(classlike.properties).let { modified = modified || it.first; it.second }, - filterClasslikes(classlike.classlikes).let { + classlikes = filterClasslikes(classlike.classlikes).let { modified = modified || it.first; it.second - }, - classlike.visibility, - classlike.supertypes, - classlike.sourceSets, - classlike.extra + } ) } helper() diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt index ff05beed..9b024a0b 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt @@ -122,21 +122,13 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe ) = functions.transform(additionalCondition) { original, filteredPlatforms -> with(original) { - DFunction( - dri, - name, - isConstructor, - parameters, - documentation.filtered(filteredPlatforms), - expectPresentInSet.filtered(filteredPlatforms), - sources.filtered(filteredPlatforms), - visibility.filtered(filteredPlatforms), - type, - generics.mapNotNull { it.filter(filteredPlatforms) }, - receiver, - modifier, - filteredPlatforms, - extra + copy( + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + sources = sources.filtered(filteredPlatforms), + visibility = visibility.filtered(filteredPlatforms), + generics = generics.mapNotNull { it.filter(filteredPlatforms) }, + sourceSets = filteredPlatforms, ) } } @@ -151,21 +143,13 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe ): Pair<Boolean, List<DProperty>> = properties.transform(additionalCondition, ::hasVisibleAccessorsForPlatform) { original, filteredPlatforms -> with(original) { - DProperty( - dri, - name, - documentation.filtered(filteredPlatforms), - expectPresentInSet.filtered(filteredPlatforms), - sources.filtered(filteredPlatforms), - visibility.filtered(filteredPlatforms), - type, - receiver, - setter, - getter, - modifier, - filteredPlatforms, - generics.mapNotNull { it.filter(filteredPlatforms) }, - extra + copy( + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + sources = sources.filtered(filteredPlatforms), + visibility = visibility.filtered(filteredPlatforms), + sourceSets = filteredPlatforms, + generics = generics.mapNotNull { it.filter(filteredPlatforms) }, ) } } @@ -235,86 +219,69 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe classlikesListChanged = classlikesListChanged || modified when { !modified -> this - this is DClass -> DClass( - dri, - name, - constructors, - functions, - properties, - classlikes, - sources.filtered(filteredPlatforms), - visibility.filtered(filteredPlatforms), - companion, - generics, - supertypes.filtered(filteredPlatforms), - documentation.filtered(filteredPlatforms), - expectPresentInSet.filtered(filteredPlatforms), - modifier, - filteredPlatforms, - extra + this is DClass -> copy( + constructors = constructors, + functions = functions, + properties = properties, + classlikes = classlikes, + sources = sources.filtered(filteredPlatforms), + visibility = visibility.filtered(filteredPlatforms), + companion = companion, + generics = generics, + supertypes = supertypes.filtered(filteredPlatforms), + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + sourceSets = filteredPlatforms ) - this is DAnnotation -> DAnnotation( - name, - dri, - documentation.filtered(filteredPlatforms), - expectPresentInSet.filtered(filteredPlatforms), - sources.filtered(filteredPlatforms), - functions, - properties, - classlikes, - visibility.filtered(filteredPlatforms), - companion, - constructors, - generics, - filteredPlatforms, - extra + this is DAnnotation -> copy( + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + sources = sources.filtered(filteredPlatforms), + functions = functions, + properties = properties, + classlikes = classlikes, + visibility = visibility.filtered(filteredPlatforms), + companion = companion, + constructors = constructors, + generics = generics, + sourceSets = filteredPlatforms ) - this is DEnum -> DEnum( - dri, - name, - enumEntries, - documentation.filtered(filteredPlatforms), - expectPresentInSet.filtered(filteredPlatforms), - sources.filtered(filteredPlatforms), - functions, - properties, - classlikes, - visibility.filtered(filteredPlatforms), - companion, - constructors, - supertypes.filtered(filteredPlatforms), - filteredPlatforms, - extra + this is DEnum -> copy( + entries = enumEntries, + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + sources = sources.filtered(filteredPlatforms), + functions = functions, + properties = properties, + classlikes = classlikes, + visibility = visibility.filtered(filteredPlatforms), + companion = companion, + constructors = constructors, + supertypes = supertypes.filtered(filteredPlatforms), + sourceSets = filteredPlatforms ) - this is DInterface -> DInterface( - dri, - name, - documentation.filtered(filteredPlatforms), - expectPresentInSet.filtered(filteredPlatforms), - sources.filtered(filteredPlatforms), - functions, - properties, - classlikes, - visibility.filtered(filteredPlatforms), - companion, - generics, - supertypes.filtered(filteredPlatforms), - filteredPlatforms, - extra + this is DInterface -> copy( + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + sources = sources.filtered(filteredPlatforms), + functions = functions, + properties = properties, + classlikes = classlikes, + visibility = visibility.filtered(filteredPlatforms), + companion = companion, + generics = generics, + supertypes = supertypes.filtered(filteredPlatforms), + sourceSets = filteredPlatforms ) - this is DObject -> DObject( - name, - dri, - documentation.filtered(filteredPlatforms), - expectPresentInSet.filtered(filteredPlatforms), - sources.filtered(filteredPlatforms), - functions, - properties, - classlikes, - visibility, - supertypes.filtered(filteredPlatforms), - filteredPlatforms, - extra + this is DObject -> copy( + documentation = documentation.filtered(filteredPlatforms), + expectPresentInSet = expectPresentInSet.filtered(filteredPlatforms), + sources = sources.filtered(filteredPlatforms), + functions = functions, + properties = properties, + classlikes = classlikes, + supertypes = supertypes.filtered(filteredPlatforms), + sourceSets = filteredPlatforms ) else -> null } diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt index ddc0cd37..2608d9ba 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt @@ -129,7 +129,7 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer { private fun callableMemberDescriptorOrNull( documentable: Documentable, sourceSet: DokkaSourceSet ): CallableMemberDescriptor? { - if (documentable is WithExpectActual) { + if (documentable is WithSources) { return documentable.sources[sourceSet] .safeAs<DescriptorDocumentableSource>()?.descriptor .safeAs() diff --git a/plugins/base/src/main/kotlin/transformers/documentables/SuppressedDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/SuppressedDocumentableFilterTransformer.kt index 7febabbb..b066e69b 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/SuppressedDocumentableFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/SuppressedDocumentableFilterTransformer.kt @@ -42,7 +42,7 @@ class SuppressedDocumentableFilterTransformer(val context: DokkaContext) : PreMe } private fun isSuppressed(documentable: Documentable): Boolean { - if (documentable !is WithExpectActual) return false + if (documentable !is WithSources) return false val sourceFile = File(source(documentable).path).absoluteFile return sourceSet(documentable).suppressedFiles.any { suppressedFile -> sourceFile.startsWith(suppressedFile.absoluteFile) diff --git a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt index 8f6f09fb..76bf0067 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt @@ -8,7 +8,7 @@ import org.jetbrains.dokka.model.DocumentableSource import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.analysis.DescriptorDocumentableSource import org.jetbrains.dokka.analysis.PsiDocumentableSource -import org.jetbrains.dokka.model.WithExpectActual +import org.jetbrains.dokka.model.WithSources import org.jetbrains.dokka.model.toDisplaySourceSets import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext @@ -23,7 +23,7 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent override fun invoke(input: RootPageNode) = input.transformContentPagesTree { node -> when (val documentable = node.documentable) { - is WithExpectActual -> resolveSources(documentable) + is WithSources -> resolveSources(documentable) .takeIf { it.isNotEmpty() } ?.let { node.addSourcesContent(it) } ?: node @@ -34,7 +34,7 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent private fun getSourceLinks() = context.configuration.sourceSets .flatMap { it.sourceLinks.map { sl -> SourceLink(sl, it) } } - private fun resolveSources(documentable: WithExpectActual) = documentable.sources + private fun resolveSources(documentable: WithSources) = documentable.sources .mapNotNull { entry -> getSourceLinks().find { File(entry.value.path).startsWith(it.path) && it.sourceSetData == entry.key }?.let { Pair( diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 57d4f151..5e6f8f20 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -158,11 +158,12 @@ private class DokkaDescriptorVisitor( generics = descriptor.declaredTypeParameters.map { it.toVariantTypeParameter() }, companion = descriptor.companion(driWithPlatform), sourceSets = setOf(sourceSet), - extra = PropertyContainer.withAll<DInterface>( + isExpectActual = (isExpect || isActual), + extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), ImplementedInterfaces(info.allImplementedInterfaces.toSourceSetDependent()) - ).let { if (isExpect || isActual) it + IsExpectActual else it } + ) ) } @@ -186,11 +187,12 @@ private class DokkaDescriptorVisitor( supertypes = info.supertypes.toSourceSetDependent(), documentation = info.docs, sourceSets = setOf(sourceSet), - extra = PropertyContainer.withAll<DObject>( + isExpectActual = (isExpect || isActual), + extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), ImplementedInterfaces(info.allImplementedInterfaces.toSourceSetDependent()) - ).let { if (isExpect || isActual) it + IsExpectActual else it } + ) ) } @@ -216,11 +218,12 @@ private class DokkaDescriptorVisitor( documentation = info.docs, companion = descriptor.companion(driWithPlatform), sourceSets = setOf(sourceSet), - extra = PropertyContainer.withAll<DEnum>( + isExpectActual = (isExpect || isActual), + extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), ImplementedInterfaces(info.allImplementedInterfaces.toSourceSetDependent()) - ).let { if (isExpect || isActual) it + IsExpectActual else it } + ) ) } @@ -261,10 +264,11 @@ private class DokkaDescriptorVisitor( properties = scope.properties(driWithPlatform), expectPresentInSet = sourceSet.takeIf { isExpect }, sourceSets = setOf(sourceSet), - extra = PropertyContainer.withAll<DAnnotation>( + isExpectActual = (isExpect || isActual), + extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations() - ).let { if (isExpect || isActual) it + IsExpectActual else it }, + ), companion = descriptor.companionObjectDescriptor?.let { objectDescriptor(it, driWithPlatform) }, visibility = descriptor.visibility.toDokkaVisibility().toSourceSetDependent(), generics = descriptor.declaredTypeParameters.map { it.toVariantTypeParameter() }, @@ -303,11 +307,12 @@ private class DokkaDescriptorVisitor( modifier = descriptor.modifier().toSourceSetDependent(), companion = descriptor.companion(driWithPlatform), sourceSets = setOf(sourceSet), + isExpectActual = (isExpect || isActual), extra = PropertyContainer.withAll<DClass>( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), ImplementedInterfaces(info.allImplementedInterfaces.toSourceSetDependent()) - ).let { if (isExpect || isActual) it + IsExpectActual else it } + ) ) } @@ -337,11 +342,12 @@ private class DokkaDescriptorVisitor( expectPresentInSet = sourceSet.takeIf { isExpect }, sourceSets = setOf(sourceSet), generics = descriptor.typeParameters.map { it.toVariantTypeParameter() }, + isExpectActual = (isExpect || isActual), extra = PropertyContainer.withAll( (descriptor.additionalExtras() + descriptor.getAnnotationsWithBackingField() .toAdditionalExtras()).toSet().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotationsWithBackingField().toSourceSetDependent().toAnnotations() - ).let { if (isExpect || isActual) it + IsExpectActual else it } + ) ) } @@ -376,11 +382,12 @@ private class DokkaDescriptorVisitor( modifier = descriptor.modifier().toSourceSetDependent(), type = descriptor.returnType!!.toBound(), sourceSets = setOf(sourceSet), - extra = PropertyContainer.withAll<DFunction>( + isExpectActual = (isExpect || isActual), + extra = PropertyContainer.withAll( InheritedFunction(inheritedFrom.toSourceSetDependent()), descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations() - ).let { if (isExpect || isActual) it + IsExpectActual else it } + ) ) } @@ -421,6 +428,7 @@ private class DokkaDescriptorVisitor( modifier = descriptor.modifier().toSourceSetDependent(), generics = descriptor.typeParameters.map { it.toVariantTypeParameter() }, sourceSets = setOf(sourceSet), + isExpectActual = (isExpect || isActual), extra = PropertyContainer.withAll<DFunction>( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations() @@ -428,7 +436,7 @@ private class DokkaDescriptorVisitor( if (descriptor.isPrimary) { it + PrimaryConstructorExtra } else it - }.let { if (isExpect || isActual) it + IsExpectActual else it } + } ) } @@ -501,10 +509,11 @@ private class DokkaDescriptorVisitor( }, sources = descriptor.createSources(), sourceSets = setOf(sourceSet), + isExpectActual = (isExpect || isActual), extra = PropertyContainer.withAll<DFunction>( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations() - ).let { if (isExpect || isActual) it + IsExpectActual else it } + ) ) } diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 30e46404..c413f5c8 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -204,6 +204,7 @@ class DefaultPsiToDocumentableTranslator( constructors.map { parseFunction(it, true) }, mapTypeParameters(dri), setOf(sourceSetData), + false, PropertyContainer.withAll( implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent() @@ -241,6 +242,7 @@ class DefaultPsiToDocumentableTranslator( constructors.map { parseFunction(it, true) }, ancestors, setOf(sourceSetData), + false, PropertyContainer.withAll( implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent() .toAnnotations() @@ -260,6 +262,7 @@ class DefaultPsiToDocumentableTranslator( mapTypeParameters(dri), ancestors, setOf(sourceSetData), + false, PropertyContainer.withAll( implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent() .toAnnotations() @@ -281,6 +284,7 @@ class DefaultPsiToDocumentableTranslator( null, modifiers, setOf(sourceSetData), + false, PropertyContainer.withAll( implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent() .toAnnotations() @@ -323,6 +327,7 @@ class DefaultPsiToDocumentableTranslator( null, psi.getModifier().toSourceSetDependent(), setOf(sourceSetData), + false, psi.additionalExtras().let { PropertyContainer.withAll( InheritedFunction(inheritedFrom.toSourceSetDependent()), @@ -454,6 +459,7 @@ class DefaultPsiToDocumentableTranslator( psi.getModifier().toSourceSetDependent(), setOf(sourceSetData), emptyList(), + false, psi.additionalExtras().let { PropertyContainer.withAll<DProperty>( it.toSourceSetDependent().toAdditionalModifiers(), |