diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-17 19:54:11 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-17 19:54:11 +0100 |
commit | c7916f74964246bee4d256c106b01c7e317e6c10 (patch) | |
tree | 39d28310f12ae4b8e3d4f182aa66b1e5b1c4319e /src/Kotlin | |
parent | 0406a6bce4f461f3ae846911505701324411fa9b (diff) | |
download | dokka-c7916f74964246bee4d256c106b01c7e317e6c10.tar.gz dokka-c7916f74964246bee4d256c106b01c7e317e6c10.tar.bz2 dokka-c7916f74964246bee4d256c106b01c7e317e6c10.zip |
default objects -> companion objects
Diffstat (limited to 'src/Kotlin')
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 18 | ||||
-rw-r--r-- | src/Kotlin/KotlinLanguageService.kt | 8 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index fba74b9b..0e0767d3 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -286,7 +286,7 @@ class DocumentationBuilder(val session: ResolveSession, val classifierDescriptor = jetType.getConstructor().getDeclarationDescriptor() val name = when (classifierDescriptor) { is ClassDescriptor -> { - if (classifierDescriptor.isDefaultObject()) { + if (classifierDescriptor.isCompanionObject()) { classifierDescriptor.getContainingDeclaration().getName().asString() + "." + classifierDescriptor.getName().asString() } @@ -436,9 +436,9 @@ class DocumentationBuilder(val session: ResolveSession, getConstructors() node.appendChildren(constructorsToDocument, DocumentationReference.Kind.Member) } - val members = getDefaultType().getMemberScope().getAllDescriptors().filter { it != getDefaultObjectDescriptor() } + val members = getDefaultType().getMemberScope().getAllDescriptors().filter { it != getCompanionObjectDescriptor() } node.appendChildren(members, DocumentationReference.Kind.Member) - val defaultObjectDescriptor = getDefaultObjectDescriptor() + val defaultObjectDescriptor = getCompanionObjectDescriptor() if (defaultObjectDescriptor != null) { node.appendChildren(defaultObjectDescriptor.getDefaultType().getMemberScope().getAllDescriptors(), DocumentationReference.Kind.Member) @@ -456,13 +456,13 @@ class DocumentationBuilder(val session: ResolveSession, return node } - private fun CallableMemberDescriptor.inDefaultObject(): Boolean { + private fun CallableMemberDescriptor.inCompanionObject(): Boolean { val containingDeclaration = getContainingDeclaration() - if ((containingDeclaration as? ClassDescriptor)?.isDefaultObject() ?: false) { + if ((containingDeclaration as? ClassDescriptor)?.isCompanionObject() ?: false) { return true } val receiver = getExtensionReceiverParameter() - return (receiver?.getType()?.getConstructor()?.getDeclarationDescriptor() as? ClassDescriptor)?.isDefaultObject() ?: false + return (receiver?.getType()?.getConstructor()?.getDeclarationDescriptor() as? ClassDescriptor)?.isCompanionObject() ?: false } fun CallableMemberDescriptor.getExtensionClassDescriptor(): ClassifierDescriptor? { @@ -475,7 +475,7 @@ class DocumentationBuilder(val session: ResolveSession, } fun FunctionDescriptor.build(): DocumentationNode { - val node = DocumentationNode(this, if (inDefaultObject()) Kind.DefaultObjectFunction else Kind.Function) + val node = DocumentationNode(this, if (inCompanionObject()) Kind.CompanionObjectFunction else Kind.Function) node.appendInPageChildren(getTypeParameters(), DocumentationReference.Kind.Detail) getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) } @@ -557,7 +557,7 @@ class DocumentationBuilder(val session: ResolveSession, } fun PropertyDescriptor.build(): DocumentationNode { - val node = DocumentationNode(this, if (inDefaultObject()) Kind.DefaultObjectProperty else Kind.Property) + val node = DocumentationNode(this, if (inCompanionObject()) Kind.CompanionObjectProperty else Kind.Property) node.appendInPageChildren(getTypeParameters(), DocumentationReference.Kind.Detail) getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) } node.appendType(getReturnType()) @@ -649,7 +649,7 @@ class DocumentationBuilder(val session: ResolveSession, fun ReceiverParameterDescriptor.build(): DocumentationNode { var receiverClass: DeclarationDescriptor = getType().getConstructor().getDeclarationDescriptor() - if ((receiverClass as? ClassDescriptor)?.isDefaultObject() ?: false) { + if ((receiverClass as? ClassDescriptor)?.isCompanionObject() ?: false) { receiverClass = receiverClass.getContainingDeclaration()!! } link(receiverClass, diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index 855745e0..d046b650 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -28,9 +28,9 @@ class KotlinLanguageService : LanguageService { DocumentationNode.Kind.Modifier -> renderModifier(node) DocumentationNode.Kind.Constructor, DocumentationNode.Kind.Function, - DocumentationNode.Kind.DefaultObjectFunction -> renderFunction(node, renderMode) + DocumentationNode.Kind.CompanionObjectFunction -> renderFunction(node, renderMode) DocumentationNode.Kind.Property, - DocumentationNode.Kind.DefaultObjectProperty -> renderProperty(node, renderMode) + DocumentationNode.Kind.CompanionObjectProperty -> renderProperty(node, renderMode) else -> identifier(node.name) } } @@ -248,7 +248,7 @@ class KotlinLanguageService : LanguageService { when (node.kind) { DocumentationNode.Kind.Constructor -> identifier(node.owner!!.name) DocumentationNode.Kind.Function, - DocumentationNode.Kind.DefaultObjectFunction -> keyword("fun ") + DocumentationNode.Kind.CompanionObjectFunction -> keyword("fun ") else -> throw IllegalArgumentException("Node $node is not a function-like object") } renderTypeParametersForNode(node) @@ -285,7 +285,7 @@ class KotlinLanguageService : LanguageService { renderAnnotationsForNode(node) when (node.kind) { DocumentationNode.Kind.Property, - DocumentationNode.Kind.DefaultObjectProperty -> keyword("${node.getPropertyKeyword()} ") + DocumentationNode.Kind.CompanionObjectProperty -> keyword("${node.getPropertyKeyword()} ") else -> throw IllegalArgumentException("Node $node is not a property") } renderTypeParametersForNode(node) |