diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2016-01-05 18:58:24 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2016-01-05 18:58:24 +0100 |
commit | b3ce9a8eed32523c3ef2ee1ce186434bd14a6e64 (patch) | |
tree | 3981b083a92695b4c841808ce4c31e2aa491661a /core/src/main | |
parent | c59a3d8455ad45d679c47a387f854bdd81a01952 (diff) | |
download | dokka-b3ce9a8eed32523c3ef2ee1ce186434bd14a6e64.tar.gz dokka-b3ce9a8eed32523c3ef2ee1ce186434bd14a6e64.tar.bz2 dokka-b3ce9a8eed32523c3ef2ee1ce186434bd14a6e64.zip |
distinguish inherited companion object members
Diffstat (limited to 'core/src/main')
4 files changed, 10 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index faa0b1ef..01f38605 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -287,7 +287,9 @@ abstract class StructuredFormatService(locationService: LocationService, appendSection("Functions", node.members(NodeKind.Function)) appendSection("Inherited Functions", node.inheritedMembers(NodeKind.Function)) appendSection("Companion Object Properties", node.members(NodeKind.CompanionObjectProperty)) + appendSection("Inherited Companion Object Properties", node.inheritedCompanionObjectMembers(NodeKind.Property)) appendSection("Companion Object Functions", node.members(NodeKind.CompanionObjectFunction)) + appendSection("Inherited Companion Object Functions", node.inheritedCompanionObjectMembers(NodeKind.Function)) appendSection("Other members", node.members.filter { it.kind !in setOf( NodeKind.Class, diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 3a35b764..a9701778 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -235,12 +235,13 @@ class DocumentationBuilder (!options.skipDeprecated || !isDeprecated()) } - fun DocumentationNode.appendMembers(descriptors: Iterable<DeclarationDescriptor>): List<DocumentationNode> { + fun DocumentationNode.appendMembers(descriptors: Iterable<DeclarationDescriptor>, + inheritedLinkKind: RefKind = RefKind.InheritedMember): List<DocumentationNode> { val nodes = descriptors.map { descriptor -> if (descriptor is CallableMemberDescriptor && descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { val baseDescriptor = descriptor.overriddenDescriptors.firstOrNull() if (baseDescriptor != null) { - link(this, baseDescriptor, RefKind.InheritedMember) + link(this, baseDescriptor, inheritedLinkKind) } null } @@ -314,7 +315,7 @@ class DocumentationBuilder if (companionObjectDescriptor != null) { val descriptors = companionObjectDescriptor.defaultType.memberScope.getContributedDescriptors() val descriptorsToDocument = descriptors.filter { it !is CallableDescriptor || !it.isInheritedFromAny() } - node.appendMembers(descriptorsToDocument) + node.appendMembers(descriptorsToDocument, RefKind.InheritedCompanionObjectMember) } node.appendAnnotations(this) node.appendModifiers(this) diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt index 121a5764..dcb50e8f 100644 --- a/core/src/main/kotlin/Model/DocumentationNode.kt +++ b/core/src/main/kotlin/Model/DocumentationNode.kt @@ -73,6 +73,8 @@ open class DocumentationNode(val name: String, get() = references(RefKind.Member).map { it.to } val inheritedMembers: List<DocumentationNode> get() = references(RefKind.InheritedMember).map { it.to } + val inheritedCompanionObjectMembers: List<DocumentationNode> + get() = references(RefKind.InheritedCompanionObjectMember).map { it.to } val extensions: List<DocumentationNode> get() = references(RefKind.Extension).map { it.to } val inheritors: List<DocumentationNode> @@ -107,6 +109,7 @@ open class DocumentationNode(val name: String, fun details(kind: NodeKind): List<DocumentationNode> = details.filter { it.kind == kind } fun members(kind: NodeKind): List<DocumentationNode> = members.filter { it.kind == kind } fun inheritedMembers(kind: NodeKind): List<DocumentationNode> = inheritedMembers.filter { it.kind == kind } + fun inheritedCompanionObjectMembers(kind: NodeKind): List<DocumentationNode> = inheritedCompanionObjectMembers.filter { it.kind == kind } fun links(kind: NodeKind): List<DocumentationNode> = links.filter { it.kind == kind } fun detail(kind: NodeKind): DocumentationNode = details.filter { it.kind == kind }.single() diff --git a/core/src/main/kotlin/Model/DocumentationReference.kt b/core/src/main/kotlin/Model/DocumentationReference.kt index 6db6d303..0b40e83a 100644 --- a/core/src/main/kotlin/Model/DocumentationReference.kt +++ b/core/src/main/kotlin/Model/DocumentationReference.kt @@ -6,6 +6,7 @@ enum class RefKind { Owner, Member, InheritedMember, + InheritedCompanionObjectMember, Detail, Link, HiddenLink, |