diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-04 20:33:49 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-04 20:33:49 +0100 |
commit | 970af572c55f5535485f955f2219a94f73e696d4 (patch) | |
tree | d0dc18b3d65ce5745e88fe4b2537136fe1e90847 /javadoc/src | |
parent | f50966b8da454a9dacc2b35267b2ffa11b227638 (diff) | |
download | dokka-970af572c55f5535485f955f2219a94f73e696d4.tar.gz dokka-970af572c55f5535485f955f2219a94f73e696d4.tar.bz2 dokka-970af572c55f5535485f955f2219a94f73e696d4.zip |
correctly show documentation for inner classes
Diffstat (limited to 'javadoc/src')
-rw-r--r-- | javadoc/src/main/kotlin/docbase.kt | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/javadoc/src/main/kotlin/docbase.kt b/javadoc/src/main/kotlin/docbase.kt index 19b29b00..8f90edfc 100644 --- a/javadoc/src/main/kotlin/docbase.kt +++ b/javadoc/src/main/kotlin/docbase.kt @@ -93,7 +93,7 @@ private fun DocumentationNode.hasModifier(name: String) = details(DocumentationN class PackageAdapter(module: ModuleNodeAdapter, node: DocumentationNode) : DocumentationNodeAdapter(module, node), PackageDoc { - private val allClasses = node.members.filter { it.kind in DocumentationNode.Kind.classLike }.toMap { it.name } + private val allClasses = node.members.collectAllTypesRecursively() override fun findClass(className: String?): ClassDoc? = allClasses.get(className)?.let { ClassDocumentationNodeAdapter(module, it) } @@ -455,11 +455,24 @@ fun DocumentationNode.lookupSuperClasses(module: ModuleNodeAdapter) = .map { module.allTypes[it?.qualifiedName] } .filterNotNull() +fun List<DocumentationNode>.collectAllTypesRecursively(): Map<String, DocumentationNode> { + val result = hashMapOf<String, DocumentationNode>() + + fun DocumentationNode.collectTypesRecursively() { + val classLikeMembers = DocumentationNode.Kind.classLike.flatMap { members(it) } + classLikeMembers.forEach { + result.put(it.qualifiedName, it) + it.collectTypesRecursively() + } + } + + forEach { it.collectTypesRecursively() } + return result +} + class ModuleNodeAdapter(val module: DocumentationModule, val reporter: DocErrorReporter, val outputPath: String) : DocumentationNodeBareAdapter(module), DocErrorReporter by reporter, RootDoc { val allPackages = module.members(DocumentationNode.Kind.Package).toMapBy { it.name } - val allTypes = module.members(DocumentationNode.Kind.Package) - .flatMap { it.members(DocumentationNode.Kind.Class) + it.members(DocumentationNode.Kind.Interface) + it.members(DocumentationNode.Kind.Enum) } - .toMapBy { it.qualifiedName } + val allTypes = module.members(DocumentationNode.Kind.Package).collectAllTypesRecursively() override fun packageNamed(name: String?): PackageDoc? = allPackages[name]?.let { PackageAdapter(this, it) } |