diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-02-26 13:16:31 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-04 14:28:14 +0100 |
commit | 10874a53b0db00c45d4ab44dfd226672dcf75115 (patch) | |
tree | 0ae29fcd867bf5c559d635d7d8e38183f10e25d0 /core/src/main/kotlin | |
parent | d41b4c65a0ace7e60f19fc9211947d894a0442f1 (diff) | |
download | dokka-10874a53b0db00c45d4ab44dfd226672dcf75115.tar.gz dokka-10874a53b0db00c45d4ab44dfd226672dcf75115.tar.bz2 dokka-10874a53b0db00c45d4ab44dfd226672dcf75115.zip |
Sketch of default signature provider
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r-- | core/src/main/kotlin/CoreExtensions.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/links/DRI.kt | 3 | ||||
-rw-r--r-- | core/src/main/kotlin/model/Documentable.kt | 15 | ||||
-rw-r--r-- | core/src/main/kotlin/model/SignatureProvider.kt | 7 |
4 files changed, 22 insertions, 7 deletions
diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt index dd6eab1b..6a1af187 100644 --- a/core/src/main/kotlin/CoreExtensions.kt +++ b/core/src/main/kotlin/CoreExtensions.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka +import org.jetbrains.dokka.model.SignatureProvider import org.jetbrains.dokka.plugability.ExtensionPoint import org.jetbrains.dokka.renderers.Renderer import org.jetbrains.dokka.transformers.descriptors.DescriptorToDocumentableTranslator @@ -18,8 +19,9 @@ object CoreExtensions { val documentableToPageTranslator by coreExtension<DocumentableToPageTranslator>() val pageTransformer by coreExtension<PageTransformer>() val renderer by coreExtension<Renderer>() + val signatureProvider by coreExtension<SignatureProvider>() - private fun <T: Any> coreExtension() = object { + private fun <T : Any> coreExtension() = object { operator fun provideDelegate(thisRef: CoreExtensions, property: KProperty<*>): Lazy<ExtensionPoint<T>> = lazy { ExtensionPoint<T>(thisRef::class.qualifiedName!!, property.name) } } diff --git a/core/src/main/kotlin/links/DRI.kt b/core/src/main/kotlin/links/DRI.kt index 791d2b5e..57ac96e5 100644 --- a/core/src/main/kotlin/links/DRI.kt +++ b/core/src/main/kotlin/links/DRI.kt @@ -68,6 +68,9 @@ val DRI.parent: DRI else -> DRI.topLevel } +val DRI.sureClassNames + get() = classNames ?: throw IllegalStateException("Malformed DRI. It requires classNames in this context.") + data class Callable( val name: String, val receiver: TypeReference? = null, diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index c16f8a87..4190edc3 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -315,7 +315,7 @@ data class TypeParameter( override val dri: DRI, override val name: String, override val documentation: PlatformDependent<DocumentationNode>, - val bounds: List<Projection>, + val bounds: List<Bound>, override val platformData: List<PlatformData>, override val extra: PropertyContainer<TypeParameter> = PropertyContainer.empty() ) : Documentable(), WithExtraProperties<TypeParameter> { @@ -325,11 +325,14 @@ data class TypeParameter( override fun withNewExtras(newExtras: PropertyContainer<TypeParameter>) = copy(extra = newExtras) } -sealed class Projection { - data class OtherParameter(val name: String) : Projection() - object Star : Projection() - data class TypeConstructor(val dri: DRI, val projections: List<Projection>) : Projection() - data class Nullable(val inner: Projection) : Projection() +sealed class Projection +sealed class Bound : Projection() +data class OtherParameter(val name: String) : Bound() +object Star : Projection() +data class TypeConstructor(val dri: DRI, val projections: List<Projection>) : Bound() +data class Nullable(val inner: Bound) : Bound() +data class Variance(val kind: Kind, val inner: Bound): Projection() { + enum class Kind { In, Out } } enum class ExtraModifiers { diff --git a/core/src/main/kotlin/model/SignatureProvider.kt b/core/src/main/kotlin/model/SignatureProvider.kt new file mode 100644 index 00000000..2df0f4b6 --- /dev/null +++ b/core/src/main/kotlin/model/SignatureProvider.kt @@ -0,0 +1,7 @@ +package org.jetbrains.dokka.model + +import org.jetbrains.dokka.pages.ContentNode + +interface SignatureProvider { + fun signature(documentable: Documentable): List<ContentNode> +}
\ No newline at end of file |