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/DocumentationBuilder.kt | |
parent | 0406a6bce4f461f3ae846911505701324411fa9b (diff) | |
download | dokka-c7916f74964246bee4d256c106b01c7e317e6c10.tar.gz dokka-c7916f74964246bee4d256c106b01c7e317e6c10.tar.bz2 dokka-c7916f74964246bee4d256c106b01c7e317e6c10.zip |
default objects -> companion objects
Diffstat (limited to 'src/Kotlin/DocumentationBuilder.kt')
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 18 |
1 files changed, 9 insertions, 9 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, |