From f3ed9f5fa553c72a254e5ca5d28e108849937769 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 12 Jan 2016 19:04:53 +0100 Subject: generate all types index --- core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core/src/main/kotlin/Kotlin') diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 3c4c0c39..1bc41f54 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -293,6 +293,7 @@ class DocumentationBuilder } propagateExtensionFunctionsToSubclasses(fragments) + generateAllTypesNode() } private fun propagateExtensionFunctionsToSubclasses(fragments: Collection) { @@ -356,6 +357,19 @@ class DocumentationBuilder return false } + private fun DocumentationNode.generateAllTypesNode() { + val allTypes = members(NodeKind.Package) + .flatMap { it.members.filter { it.kind in NodeKind.classLike || it.kind == NodeKind.ExternalClass } } + .sortedBy { if (it.kind == NodeKind.ExternalClass) it.name.substringAfterLast('.') else it.name } + + val allTypesNode = DocumentationNode("alltypes", Content.Empty, NodeKind.AllTypes) + for (typeNode in allTypes) { + allTypesNode.addReferenceTo(typeNode, RefKind.Member) + } + + append(allTypesNode, RefKind.Member) + } + fun DeclarationDescriptor.build(): DocumentationNode = when (this) { is ClassDescriptor -> build() is ConstructorDescriptor -> build() -- cgit