aboutsummaryrefslogtreecommitdiff
path: root/src/Generation/KotlinSignatureGenerator.kt
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 18:37:12 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 18:37:12 +0400
commita89d1a138764aa0ae370b3908628d242f2eff50e (patch)
tree6497c34f59b8fa7483f4a8f6c2865717edf20aac /src/Generation/KotlinSignatureGenerator.kt
parentf97d9ccd2282ba13bf3ce5e938bd2932b27c8c47 (diff)
downloaddokka-a89d1a138764aa0ae370b3908628d242f2eff50e.tar.gz
dokka-a89d1a138764aa0ae370b3908628d242f2eff50e.tar.bz2
dokka-a89d1a138764aa0ae370b3908628d242f2eff50e.zip
Support functional type syntax in Kotlin generator
Diffstat (limited to 'src/Generation/KotlinSignatureGenerator.kt')
-rw-r--r--src/Generation/KotlinSignatureGenerator.kt15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Generation/KotlinSignatureGenerator.kt b/src/Generation/KotlinSignatureGenerator.kt
index 1fae62f0..e73dd8d9 100644
--- a/src/Generation/KotlinSignatureGenerator.kt
+++ b/src/Generation/KotlinSignatureGenerator.kt
@@ -29,7 +29,20 @@ class KotlinSignatureGenerator : SignatureGenerator {
}
override fun renderType(node: DocumentationNode): String {
- return node.name
+ val typeArguments = node.details(Kind.Type)
+ val renders = typeArguments.map { renderType(it) }
+
+ if (node.name == "Function${typeArguments.count() - 1}") {
+ // lambda
+ return "(${renders.take(renders.size - 1).join()})->${renders.last()}"
+ }
+ if (node.name == "ExtensionFunction${typeArguments.count() - 2}") {
+ // extension lambda
+ return "${renders.first()}.(${renders.drop(1).take(renders.size - 2).join()})->${renders.last()}"
+ }
+ if (typeArguments.none())
+ return node.name
+ return "${node.name}<${renders.join()}>"
}
override fun renderModifier(node: DocumentationNode): String {