aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-10-21 18:26:10 +0200
committerDmitry Jemerov <yole@jetbrains.com>2015-10-21 18:26:10 +0200
commitb8f2435e2db50c2053a9d880ab9573cb0bc2630e (patch)
tree55274c5b5e67191e32983559ffb8ea15c0c4df86 /src/Kotlin
parent8827d30048b9c50f47e62f69baf774363fdebc5d (diff)
downloaddokka-b8f2435e2db50c2053a9d880ab9573cb0bc2630e.tar.gz
dokka-b8f2435e2db50c2053a9d880ab9573cb0bc2630e.tar.bz2
dokka-b8f2435e2db50c2053a9d880ab9573cb0bc2630e.zip
M15 code cleanup
Diffstat (limited to 'src/Kotlin')
-rw-r--r--src/Kotlin/ContentBuilder.kt4
-rw-r--r--src/Kotlin/DocumentationBuilder.kt16
-rw-r--r--src/Kotlin/KotlinLanguageService.kt2
3 files changed, 11 insertions, 11 deletions
diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt
index 4dfcec3b..c981eb42 100644
--- a/src/Kotlin/ContentBuilder.kt
+++ b/src/Kotlin/ContentBuilder.kt
@@ -165,9 +165,9 @@ fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functio
else -> psiElement.text
}
- val lines = text.trimEnd().split("\n".toRegex()).toTypedArray().filterNot { it.length() == 0 }
+ val lines = text.trimEnd().split("\n".toRegex()).toTypedArray().filterNot { it.length == 0 }
val indent = lines.map { it.takeWhile { it.isWhitespace() }.count() }.min() ?: 0
- val finalText = lines.map { it.drop(indent) }.join("\n")
+ val finalText = lines.map { it.drop(indent) }.joinToString("\n")
return ContentBlockCode("kotlin").let() { it.append(ContentText(finalText)); it }
}
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 3f3eea67..b1aef822 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -154,13 +154,13 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
if (extensionReceiver != null) {
params.add(0, extensionReceiver.type)
}
- return "(" + params.map { it.signature() }.join() + ")"
+ return "(" + params.map { it.signature() }.joinToString() + ")"
}
fun KtType.signature(): String {
val declarationDescriptor = constructor.declarationDescriptor ?: return "<null>"
val typeName = DescriptorUtils.getFqName(declarationDescriptor).asString()
- if (typeName == "Array" && arguments.size() == 1) {
+ if (typeName == "Array" && arguments.size == 1) {
return "Array<" + arguments.first().type.signature() + ">"
}
return typeName
@@ -243,7 +243,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
refGraph.register(descriptor.signature(), node)
}
- fun DocumentationNode<T>(descriptor: T, kind: Kind): DocumentationNode where T : DeclarationDescriptor, T : Named {
+ fun <T> DocumentationNode(descriptor: T, kind: Kind): DocumentationNode where T : DeclarationDescriptor, T : Named {
val doc = parseDocumentation(descriptor)
val node = DocumentationNode(descriptor.name.asString(), doc, kind).withModifiers(descriptor)
return node
@@ -267,7 +267,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
modality = Modality.FINAL
}
}
- val modifier = modality.name().toLowerCase()
+ val modifier = modality.name.toLowerCase()
appendTextNode(modifier, DocumentationNode.Kind.Modifier)
}
@@ -475,7 +475,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
if (getKind() != ClassKind.OBJECT && getKind() != ClassKind.ENUM_ENTRY) {
node.appendInPageChildren(typeConstructor.parameters, DocumentationReference.Kind.Detail)
val constructorsToDocument = if (getKind() == ClassKind.ENUM_CLASS)
- constructors.filter { it.valueParameters.size() > 0 }
+ constructors.filter { it.valueParameters.size > 0 }
else
constructors
node.appendChildren(constructorsToDocument, DocumentationReference.Kind.Member)
@@ -571,7 +571,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
}
fun FunctionDescriptor.getImplementedOperator(): String? {
- var arity = valueParameters.size()
+ var arity = valueParameters.size
if (containingDeclaration is ClassDescriptor) {
arity++
}
@@ -589,7 +589,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
else null
if (token is KtSingleValueToken) {
- return token.getValue()
+ return token.value
}
val name = name.asString()
@@ -599,7 +599,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
if (arity >= 2 && (name == "get" || name == "set")) {
return "[]"
}
- if (arity == 2 && name == "equals" && valueParameters.size() == 1 &&
+ if (arity == 2 && name == "equals" && valueParameters.size == 1 &&
KotlinBuiltIns.isNullableAny(valueParameters.first().type)) {
return "=="
}
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 6541e46c..12a0bcda 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -86,7 +86,7 @@ class KotlinLanguageService : LanguageService {
typeArguments = typeArguments.drop(1)
}
symbol("(")
- renderList(typeArguments.take(typeArguments.size() - 1), noWrap = true) {
+ renderList(typeArguments.take(typeArguments.size - 1), noWrap = true) {
renderType(it)
}
symbol(")")