diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-26 17:11:51 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-26 17:11:51 +0100 |
commit | f9b7ea8fa9da20f6758788dd4b2b24820825bc5e (patch) | |
tree | 730f9507c8e53727f9fbd79275ce869de88c0d43 /src/Kotlin/DocumentationBuilder.kt | |
parent | f8704c63e7ba267beb9370bc22ff96dde75b0f9f (diff) | |
download | dokka-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/Kotlin/DocumentationBuilder.kt')
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 20 |
1 files changed, 7 insertions, 13 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 != "") { |