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 /core/src | |
parent | 956e5ff3b21290d536b45f2a185f419416eb5554 (diff) | |
download | dokka-883408f0d12abfba88434b41cd8d752afc7ebf35.tar.gz dokka-883408f0d12abfba88434b41cd8d752afc7ebf35.tar.bz2 dokka-883408f0d12abfba88434b41cd8d752afc7ebf35.zip |
Apply requested changes
Diffstat (limited to 'core/src')
4 files changed, 27 insertions, 17 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 0ffc2f84..2efaf539 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -26,7 +26,7 @@ abstract class Documentable : WithChildren<Documentable> { typealias SourceSetDependent<T> = Map<DokkaSourceSet, T> -interface WithExpectActual { +interface WithSources { val sources: SourceSetDependent<DocumentableSource> } @@ -79,11 +79,15 @@ interface WithSupertypes { val supertypes: SourceSetDependent<List<TypeConstructorWithKind>> } -interface Callable : WithVisibility, WithType, WithAbstraction, WithExpectActual { +interface WithIsExpectActual { + val isExpectActual: Boolean +} + +interface Callable : WithVisibility, WithType, WithAbstraction, WithSources { val receiver: DParameter? } -sealed class DClasslike : Documentable(), WithScope, WithVisibility, WithExpectActual +sealed class DClasslike : Documentable(), WithScope, WithVisibility, WithSources, WithIsExpectActual data class DModule( override val name: String, @@ -143,9 +147,10 @@ data class DClass( override val expectPresentInSet: DokkaSourceSet?, override val modifier: SourceSetDependent<Modifier>, override val sourceSets: Set<DokkaSourceSet>, + override val isExpectActual: Boolean, override val extra: PropertyContainer<DClass> = PropertyContainer.empty() ) : DClasslike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes, - WithExtraProperties<DClass> { + WithExtraProperties<DClass>, WithIsExpectActual { override val children: List<Documentable> get() = (functions + properties + classlikes + constructors) @@ -168,8 +173,9 @@ data class DEnum( override val constructors: List<DFunction>, override val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>, override val sourceSets: Set<DokkaSourceSet>, + override val isExpectActual: Boolean, override val extra: PropertyContainer<DEnum> = PropertyContainer.empty() -) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties<DEnum> { +) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties<DEnum>, WithIsExpectActual { override val children: List<Documentable> get() = (entries + functions + properties + classlikes + constructors) @@ -207,8 +213,9 @@ data class DFunction( override val receiver: DParameter?, override val modifier: SourceSetDependent<Modifier>, override val sourceSets: Set<DokkaSourceSet>, + override val isExpectActual: Boolean, override val extra: PropertyContainer<DFunction> = PropertyContainer.empty() -) : Documentable(), Callable, WithGenerics, WithExtraProperties<DFunction> { +) : Documentable(), Callable, WithGenerics, WithExtraProperties<DFunction>, WithIsExpectActual { override val children: List<Documentable> get() = parameters @@ -229,8 +236,9 @@ data class DInterface( override val generics: List<DTypeParameter>, override val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>, override val sourceSets: Set<DokkaSourceSet>, + override val isExpectActual: Boolean, override val extra: PropertyContainer<DInterface> = PropertyContainer.empty() -) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties<DInterface> { +) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties<DInterface>, WithIsExpectActual { override val children: List<Documentable> get() = (functions + properties + classlikes) @@ -249,8 +257,9 @@ data class DObject( override val visibility: SourceSetDependent<Visibility>, override val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>, override val sourceSets: Set<DokkaSourceSet>, + override val isExpectActual: Boolean, override val extra: PropertyContainer<DObject> = PropertyContainer.empty() -) : DClasslike(), WithSupertypes, WithExtraProperties<DObject> { +) : DClasslike(), WithSupertypes, WithExtraProperties<DObject>, WithIsExpectActual { override val children: List<Documentable> get() = (functions + properties + classlikes) @@ -271,8 +280,9 @@ data class DAnnotation( override val constructors: List<DFunction>, override val generics: List<DTypeParameter>, override val sourceSets: Set<DokkaSourceSet>, + override val isExpectActual: Boolean, override val extra: PropertyContainer<DAnnotation> = PropertyContainer.empty() -) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties<DAnnotation>, WithGenerics { +) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties<DAnnotation>, WithGenerics, WithIsExpectActual { override val children: List<Documentable> get() = (functions + properties + classlikes + constructors) @@ -293,8 +303,9 @@ data class DProperty( override val modifier: SourceSetDependent<Modifier>, override val sourceSets: Set<DokkaSourceSet>, override val generics: List<DTypeParameter>, + override val isExpectActual: Boolean, override val extra: PropertyContainer<DProperty> = PropertyContainer.empty() -) : Documentable(), Callable, WithExtraProperties<DProperty>, WithGenerics { +) : Documentable(), Callable, WithExtraProperties<DProperty>, WithGenerics, WithIsExpectActual { override val children: List<Nothing> get() = emptyList() diff --git a/core/src/main/kotlin/model/documentableProperties.kt b/core/src/main/kotlin/model/documentableProperties.kt index 823b88a0..2845c7fc 100644 --- a/core/src/main/kotlin/model/documentableProperties.kt +++ b/core/src/main/kotlin/model/documentableProperties.kt @@ -25,7 +25,3 @@ data class ImplementedInterfaces(val interfaces: SourceSetDependent<List<TypeCon override val key: ExtraProperty.Key<Documentable, *> = ImplementedInterfaces } - -object IsExpectActual: ExtraProperty<WithExpectActual>, ExtraProperty.Key<WithExpectActual, IsExpectActual> { - override val key: ExtraProperty.Key<WithExpectActual, IsExpectActual> = this -}
\ No newline at end of file diff --git a/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt index df568c7e..60769e9b 100644 --- a/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt +++ b/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt @@ -4,7 +4,7 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.DokkaConfiguration.PackageOptions import org.jetbrains.dokka.model.DModule import org.jetbrains.dokka.model.Documentable -import org.jetbrains.dokka.model.WithExpectActual +import org.jetbrains.dokka.model.WithSources interface PreMergeDocumentableTransformer { operator fun invoke(modules: List<DModule>): List<DModule> @@ -32,5 +32,5 @@ fun PreMergeDocumentableTransformer.perPackageOptions(documentable: Documentable .firstOrNull { packageOptions -> packageName.startsWith(packageOptions.prefix) } } -fun <T> PreMergeDocumentableTransformer.source(documentable: T) where T : Documentable, T : WithExpectActual = +fun <T> PreMergeDocumentableTransformer.source(documentable: T) where T : Documentable, T : WithSources = checkNotNull(documentable.sources[sourceSet(documentable)]) diff --git a/core/src/test/kotlin/model/DocumentableTest.kt b/core/src/test/kotlin/model/DocumentableTest.kt index a801d549..0652831c 100644 --- a/core/src/test/kotlin/model/DocumentableTest.kt +++ b/core/src/test/kotlin/model/DocumentableTest.kt @@ -26,6 +26,7 @@ class DocumentableTest { sources = emptyMap(), sourceSets = emptySet(), supertypes = emptyMap(), + isExpectActual = false, functions = listOf( DFunction( dri = DRI(), @@ -41,6 +42,7 @@ class DocumentableTest { type = Void, receiver = null, isConstructor = false, + isExpectActual = false, parameters = listOf( DParameter( dri = DRI(), @@ -76,6 +78,7 @@ class DocumentableTest { type = Void, receiver = null, isConstructor = false, + isExpectActual = false, parameters = listOf( DParameter( dri = DRI(), @@ -105,4 +108,4 @@ class DocumentableTest { dClass.withDescendants().map { it.name }.toList() ) } -}
\ No newline at end of file +} |