diff options
author | Sergey Mashkov <sergey.mashkov@jetbrains.com> | 2015-08-06 11:52:46 +0300 |
---|---|---|
committer | Sergey Mashkov <sergey.mashkov@jetbrains.com> | 2015-08-06 11:52:46 +0300 |
commit | 9b0c1b9b0d132aba484cafbb7e12d2e132522715 (patch) | |
tree | df42c875fad08b3dbd1863ce68d4296550c21581 /src | |
parent | 4ed808d935125ab370d988f9cb32d96839959964 (diff) | |
download | dokka-9b0c1b9b0d132aba484cafbb7e12d2e132522715.tar.gz dokka-9b0c1b9b0d132aba484cafbb7e12d2e132522715.tar.bz2 dokka-9b0c1b9b0d132aba484cafbb7e12d2e132522715.zip |
~ move array type conversion to JavaLanguageService
Diffstat (limited to 'src')
-rw-r--r-- | src/Languages/JavaLanguageService.kt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Languages/JavaLanguageService.kt b/src/Languages/JavaLanguageService.kt index ad8307c1..488a2dc4 100644 --- a/src/Languages/JavaLanguageService.kt +++ b/src/Languages/JavaLanguageService.kt @@ -46,6 +46,18 @@ public class JavaLanguageService : LanguageService { } } + public fun getArrayElementType(node: DocumentationNode): DocumentationNode? = when (node.name) { + "Array" -> node.details(Kind.Type).singleOrNull()?.let { et -> getArrayElementType(et) ?: et } ?: DocumentationNode("Object", node.content, DocumentationNode.Kind.ExternalClass) + "IntArray", "LongArray", "ShortArray", "ByteArray", "CharArray", "DoubleArray", "FloatArray", "BooleanArray" -> DocumentationNode(node.name.removeSuffix("Array").toLowerCase(), node.content, DocumentationNode.Kind.Type) + else -> null + } + + public fun getArrayDimension(node: DocumentationNode): Int = when (node.name) { + "Array" -> 1 + (node.details(DocumentationNode.Kind.Type).singleOrNull()?.let { getArrayDimension(it) } ?: 0) + "IntArray", "LongArray", "ShortArray", "ByteArray", "CharArray", "DoubleArray", "FloatArray", "BooleanArray" -> 1 + else -> 0 + } + public fun renderType(node: DocumentationNode): String { return when (node.name) { "Unit" -> "void" |