aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-03-16 11:25:20 +0100
committerKamil Doległo <kamilok1965@users.noreply.github.com>2020-03-18 14:16:44 +0100
commita1322a1ab11b4395199eb3ca08bfb2349627dcfd (patch)
treec91fdc99341dfdc0fdafeb9ff68fd474b9b406a6 /plugins/base/src/main/kotlin
parentf14f20c04bebb6c8a03f7963a3f8a6c0cf992429 (diff)
downloaddokka-a1322a1ab11b4395199eb3ca08bfb2349627dcfd.tar.gz
dokka-a1322a1ab11b4395199eb3ca08bfb2349627dcfd.tar.bz2
dokka-a1322a1ab11b4395199eb3ca08bfb2349627dcfd.zip
Signatures for functional types
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 8a080bb9..dd99d0cd 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -71,7 +71,11 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
list(f.parameters) {
text(it.name!!)
text(": ")
+
signatureForProjection(it.type)
+// val type = it.type
+// if (type is KotlinTypeWrapper && type.isFunctionType) funType(type)
+// else type(type)
}
text(")")
val returnType = f.type
@@ -112,6 +116,26 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
is PrimitiveJavaType -> signatureForProjection(p.translateToKotlin())
}
+
+ fun PageContentBuilder.DocumentableContentBuilder.funType(type: KotlinTypeWrapper) {
+ if (type.isExtension) {
+ type(type.arguments.first())
+ text(".")
+ }
+
+ val args = if (type.isExtension) {
+ type.arguments.drop(1)
+ } else
+ type.arguments
+
+ text("(")
+ args.subList(0, args.size - 1).forEachIndexed { i, arg ->
+ type(arg)
+ if (i < args.size - 2) text(", ")
+ }
+ text(") -> ")
+ type(args.last())
+ }
}
private fun PrimitiveJavaType.translateToKotlin() = TypeConstructor(