aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-26 17:11:51 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-26 17:11:51 +0100
commitf9b7ea8fa9da20f6758788dd4b2b24820825bc5e (patch)
tree730f9507c8e53727f9fbd79275ce869de88c0d43 /src
parentf8704c63e7ba267beb9370bc22ff96dde75b0f9f (diff)
downloaddokka-f9b7ea8fa9da20f6758788dd4b2b24820825bc5e.tar.gz
dokka-f9b7ea8fa9da20f6758788dd4b2b24820825bc5e.tar.bz2
dokka-f9b7ea8fa9da20f6758788dd4b2b24820825bc5e.zip
variance modifiers for type projections are separate modifier nodes, not part of the type name
Diffstat (limited to 'src')
-rw-r--r--src/Kotlin/DocumentationBuilder.kt20
-rw-r--r--src/Kotlin/KotlinLanguageService.kt15
2 files changed, 17 insertions, 18 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 7804fd72..da7552a7 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -212,12 +212,7 @@ class DocumentationBuilder(val session: ResolveSession,
}
fun DocumentationNode.appendProjection(projection: TypeProjection, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type) {
- val prefix = when (projection.getProjectionKind()) {
- Variance.IN_VARIANCE -> "in "
- Variance.OUT_VARIANCE -> "out "
- else -> ""
- }
- appendType(projection.getType(), kind, prefix)
+ appendType(projection.getType(), kind, projection.getProjectionKind().label)
}
fun DocumentationNode.appendType(jetType: JetType?, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type, prefix: String = "") {
@@ -225,11 +220,14 @@ class DocumentationBuilder(val session: ResolveSession,
return
val classifierDescriptor = jetType.getConstructor().getDeclarationDescriptor()
val name = when (classifierDescriptor) {
- is Named -> prefix + classifierDescriptor.getName().asString() + if (jetType.isMarkedNullable()) "?" else ""
+ is Named -> classifierDescriptor.getName().asString() + if (jetType.isMarkedNullable()) "?" else ""
else -> "<anonymous>"
}
val node = DocumentationNode(name, Content.Empty, kind)
- if (classifierDescriptor != null)
+ if (prefix != "") {
+ node.appendTextNode(prefix, Kind.Modifier)
+ }
+ if (classifierDescriptor != null){}
link(node, classifierDescriptor)
append(node, DocumentationReference.Kind.Detail)
@@ -473,11 +471,7 @@ class DocumentationBuilder(val session: ResolveSession,
fun TypeParameterDescriptor.build(): DocumentationNode {
val doc = parseDocumentation(this)
val name = getName().asString()
- val prefix = when (getVariance()) {
- Variance.IN_VARIANCE -> "in"
- Variance.OUT_VARIANCE -> "out"
- else -> ""
- }
+ val prefix = getVariance().label
val node = DocumentationNode(name, doc, DocumentationNode.Kind.TypeParameter)
if (prefix != "") {
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index a4f62c3f..ab1f7016 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -104,6 +104,7 @@ class KotlinLanguageService : LanguageService {
renderType(typeArguments.last())
return
}
+ renderSingleModifier(node)
renderLinked(node) { identifier(it.name) }
if (typeArguments.any()) {
symbol("<")
@@ -125,11 +126,7 @@ class KotlinLanguageService : LanguageService {
}
private fun ContentBlock.renderTypeParameter(node: DocumentationNode) {
- val modifier = node.details(DocumentationNode.Kind.Modifier).singleOrNull()
- if (modifier != null) {
- keyword(modifier.name)
- nbsp()
- }
+ renderSingleModifier(node)
identifier(node.name)
@@ -144,6 +141,14 @@ class KotlinLanguageService : LanguageService {
}
}
+ private fun ContentBlock.renderSingleModifier(node: DocumentationNode) {
+ val modifier = node.details(DocumentationNode.Kind.Modifier).singleOrNull()
+ if (modifier != null) {
+ keyword(modifier.name)
+ nbsp()
+ }
+ }
+
private fun ContentBlock.renderParameter(node: DocumentationNode) {
renderAnnotationsForNode(node)
identifier(node.name)