From 4a018fa175bee9e7223232cbaf6365c81c540239 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 13 Feb 2015 12:38:32 +0100 Subject: allow multiple builders to provide package nodes; move some kotlin-independent logic to DocumentationNode --- src/Kotlin/DocumentationBuilder.kt | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/Kotlin') diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index f1be8a50..068f251a 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -38,7 +38,6 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati val descriptorToNode = hashMapOf() val nodeToDescriptor = hashMapOf() val links = hashMapOf() - val packages = hashMapOf() fun parseDocumentation(descriptor: DeclarationDescriptor): Content { val kdoc = KDocFinder.findKDoc(descriptor) @@ -119,15 +118,6 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati return this } - fun DocumentationNode.append(child: DocumentationNode, kind: DocumentationReference.Kind) { - addReferenceTo(child, kind) - when (kind) { - DocumentationReference.Kind.Detail -> child.addReferenceTo(this, DocumentationReference.Kind.Owner) - DocumentationReference.Kind.Member -> child.addReferenceTo(this, DocumentationReference.Kind.Owner) - DocumentationReference.Kind.Owner -> child.addReferenceTo(this, DocumentationReference.Kind.Member) - } - } - fun DocumentationNode.appendModality(descriptor: MemberDescriptor) { var modality = descriptor.getModality() if (modality == Modality.OPEN) { @@ -269,13 +259,12 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati } for ((packageName, declarations) in descriptors) { logger.info(" package $packageName: ${declarations.count()} declarations") - val packageNode = DocumentationNode(packageName, Content.Empty, Kind.Package) + val packageNode = findOrCreatePackageNode(packageName) val externalClassNodes = hashMapOf() declarations.forEach { descriptor -> val parent = packageNode.getParentForPackageMember(descriptor, externalClassNodes) parent.appendChild(descriptor, DocumentationReference.Kind.Member) } - append(packageNode, DocumentationReference.Kind.Member) } } -- cgit