aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-16 16:48:11 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-16 16:48:11 +0100
commit76e0db0359d8bdcdbbc7efddeccf115c2e5c731d (patch)
tree30bebe0bc4e334a55c2aaaf927a9aee995ddc98f /src/Kotlin
parent614f5fafd60d845b1befc1f6eb6b18984b7ef351 (diff)
downloaddokka-76e0db0359d8bdcdbbc7efddeccf115c2e5c731d.tar.gz
dokka-76e0db0359d8bdcdbbc7efddeccf115c2e5c731d.tar.bz2
dokka-76e0db0359d8bdcdbbc7efddeccf115c2e5c731d.zip
API to create simple text nodes more easily
Diffstat (limited to 'src/Kotlin')
-rw-r--r--src/Kotlin/DocumentationBuilder.kt21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 775c959a..e77f97c9 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -120,14 +120,12 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
}
}
val modifier = modality.name().toLowerCase()
- val node = DocumentationNode(modifier, Content.Empty, DocumentationNode.Kind.Modifier)
- append(node, DocumentationReference.Kind.Detail)
+ appendTextNode(modifier, DocumentationNode.Kind.Modifier)
}
fun DocumentationNode.appendVisibility(descriptor: DeclarationDescriptorWithVisibility) {
val modifier = descriptor.getVisibility().toString()
- val node = DocumentationNode(modifier, Content.Empty, DocumentationNode.Kind.Modifier)
- append(node, DocumentationReference.Kind.Detail)
+ appendTextNode(modifier, DocumentationNode.Kind.Modifier)
}
fun DocumentationNode.appendSupertypes(descriptor: ClassDescriptor) {
@@ -261,7 +259,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
}
val node = DocumentationNode(this, kind)
if (isInner()) {
- node.append(DocumentationNode("inner", Content.Empty, Kind.Modifier), DocumentationReference.Kind.Detail)
+ node.appendTextNode("inner", Kind.Modifier)
}
node.appendSupertypes(this)
if (getKind() != ClassKind.OBJECT && getKind() != ClassKind.ENUM_ENTRY) {
@@ -337,8 +335,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
node.appendAnnotations(this)
node.appendSourceLink(getSource())
if (isVar()) {
- node.append(DocumentationNode("var", Content.Empty, DocumentationNode.Kind.Modifier),
- DocumentationReference.Kind.Detail)
+ node.appendTextNode("var", DocumentationNode.Kind.Modifier)
}
getGetter()?.let {
if (!it.isDefault())
@@ -357,7 +354,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
val node = DocumentationNode(this, Kind.Parameter)
val varargType = getVarargElementType()
if (varargType != null) {
- node.append(DocumentationNode("vararg", Content.Empty, Kind.Annotation), DocumentationReference.Kind.Annotation)
+ node.appendTextNode("vararg", Kind.Annotation, DocumentationReference.Kind.Annotation)
node.appendType(varargType)
} else {
node.appendType(getType())
@@ -367,7 +364,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
if (psi != null) {
val defaultValueText = psi.getDefaultValue()?.getText()
if (defaultValueText != null) {
- node.append(DocumentationNode(defaultValueText, Content.Empty, Kind.Value), DocumentationReference.Kind.Detail)
+ node.appendTextNode(defaultValueText, Kind.Value)
}
}
}
@@ -391,15 +388,13 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
for (constraint in getUpperBounds()) {
if (constraint == builtIns.getDefaultBound())
continue
- val constraintNode = DocumentationNode(constraint.toString(), Content.Empty, DocumentationNode.Kind.UpperBound)
- node.append(constraintNode, DocumentationReference.Kind.Detail)
+ node.appendTextNode(constraint.toString(), DocumentationNode.Kind.UpperBound)
}
for (constraint in getLowerBounds()) {
if (KotlinBuiltIns.isNothing(constraint))
continue
- val constraintNode = DocumentationNode(constraint.toString(), Content.Empty, DocumentationNode.Kind.LowerBound)
- node.append(constraintNode, DocumentationReference.Kind.Detail)
+ node.appendTextNode(constraint.toString(), DocumentationNode.Kind.LowerBound)
}
return node
}