diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-02 12:25:00 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-02 12:25:00 +0100 |
commit | cad221f454adceb12d74fc563788b3d8247e44f6 (patch) | |
tree | 6e0ec083098476cc284b51bc19e03e8f4c5e1216 /src/Kotlin | |
parent | f9172b3a632181ee9b7ab5d674e537f4a71874eb (diff) | |
download | dokka-cad221f454adceb12d74fc563788b3d8247e44f6.tar.gz dokka-cad221f454adceb12d74fc563788b3d8247e44f6.tar.bz2 dokka-cad221f454adceb12d74fc563788b3d8247e44f6.zip |
represent nullability in doc model instead of appending ? to type name
Diffstat (limited to 'src/Kotlin')
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 5 | ||||
-rw-r--r-- | src/Kotlin/KotlinLanguageService.kt | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index d8933087..3b7f25d6 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -224,13 +224,16 @@ class DocumentationBuilder(val session: ResolveSession, return val classifierDescriptor = jetType.getConstructor().getDeclarationDescriptor() val name = when (classifierDescriptor) { - is Named -> classifierDescriptor.getName().asString() + if (jetType.isMarkedNullable()) "?" else "" + is Named -> classifierDescriptor.getName().asString() else -> "<anonymous>" } val node = DocumentationNode(name, Content.Empty, kind) if (prefix != "") { node.appendTextNode(prefix, Kind.Modifier) } + if (jetType.isMarkedNullable()) { + node.appendTextNode("?", Kind.NullabilityModifier) + } if (classifierDescriptor != null && !classifierDescriptor.isBoringBuiltinClass()) { link(node, classifierDescriptor) } diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index 4b43fb88..855745e0 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -114,6 +114,10 @@ class KotlinLanguageService : LanguageService { } symbol(">") } + val nullabilityModifier = node.details(DocumentationNode.Kind.NullabilityModifier).singleOrNull() + if (nullabilityModifier != null) { + symbol(nullabilityModifier.name) + } } private fun ContentBlock.renderModifier(node: DocumentationNode) { |