From af1ea32aa3f1e71cd47851a4a06344431801c8fd Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Thu, 2 Apr 2020 18:20:34 +0200 Subject: Add Typealiases rendering and merging --- core/src/main/kotlin/model/Documentable.kt | 5 +++-- core/src/main/kotlin/model/aditionalExtras.kt | 18 +++++++++++++++--- core/src/main/kotlin/pages/ContentNodes.kt | 5 +++-- 3 files changed, 21 insertions(+), 7 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 42b49b82..f91383de 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -349,11 +349,12 @@ data class DTypeAlias( override val dri: DRI, override val name: String, override val type: Bound, - val underlyingType: Bound, + val underlyingType: PlatformDependent, + override val visibility: PlatformDependent, override val documentation: PlatformDependent, override val platformData: List, override val extra: PropertyContainer = PropertyContainer.empty() -) : Documentable(), WithType, WithExtraProperties { +) : Documentable(), WithType, WithVisibility, WithExtraProperties { override val children: List get() = emptyList() diff --git a/core/src/main/kotlin/model/aditionalExtras.kt b/core/src/main/kotlin/model/aditionalExtras.kt index af399745..58209939 100644 --- a/core/src/main/kotlin/model/aditionalExtras.kt +++ b/core/src/main/kotlin/model/aditionalExtras.kt @@ -28,8 +28,8 @@ class Annotations(val content: List) : ExtraProperty { override val key: ExtraProperty.Key = Annotations data class Annotation(val dri: DRI, val params: Map) { - override fun equals(other: Any?): Boolean = when(other) { - is Annotation -> dri.equals(other.dri) + override fun equals(other: Any?): Boolean = when (other) { + is Annotation -> dri == other.dri else -> false } @@ -37,6 +37,18 @@ class Annotations(val content: List) : ExtraProperty { } } -object PrimaryConstructorExtra: ExtraProperty, ExtraProperty.Key { +object PrimaryConstructorExtra : ExtraProperty, ExtraProperty.Key { override val key: ExtraProperty.Key = this +} + +data class ActualTypealias(val underlyingType: PlatformDependent) : ExtraProperty { + companion object : ExtraProperty.Key { + override fun mergeStrategyFor( + left: ActualTypealias, + right: ActualTypealias + ) = + MergeStrategy.Replace(ActualTypealias(PlatformDependent(left.underlyingType + right.underlyingType))) + } + + override val key: ExtraProperty.Key = ActualTypealias } \ No newline at end of file diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index c1792759..61bc3dfc 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -167,10 +167,11 @@ interface Style interface Kind enum class ContentKind : Kind { - Comment, Constructors, Functions, Parameters, Properties, Classlikes, Packages, Symbol, Sample, Main, BriefComment, Empty; + Comment, Constructors, Functions, Parameters, Properties, Classlikes, Packages, Symbol, Sample, Main, BriefComment, + Empty, TypeAliases; companion object{ - private val platformTagged = setOf(Constructors, Functions, Properties, Classlikes, Packages) + private val platformTagged = setOf(Constructors, Functions, Properties, Classlikes, Packages, TypeAliases) fun shouldBePlatformTagged(kind: Kind) : Boolean = kind in platformTagged } -- cgit