aboutsummaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 15:44:32 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 15:44:32 +0400
commit08e690021ce2df402134ea5cebd769183499c771 (patch)
tree5c8c95a9fcc26bb31e65cb08ac762980e46e1040 /src/Model
parent71aacc5719cf59d2284592018177fbf8d71d12e4 (diff)
downloaddokka-08e690021ce2df402134ea5cebd769183499c771.tar.gz
dokka-08e690021ce2df402134ea5cebd769183499c771.tar.bz2
dokka-08e690021ce2df402134ea5cebd769183499c771.zip
Migrate to PackageView processing to unify all package fragments into single item.
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/DocumentationModule.kt14
-rw-r--r--src/Model/DocumentationNodeBuilder.kt6
2 files changed, 12 insertions, 8 deletions
diff --git a/src/Model/DocumentationModule.kt b/src/Model/DocumentationModule.kt
index 1f30268e..6b2773ed 100644
--- a/src/Model/DocumentationModule.kt
+++ b/src/Model/DocumentationModule.kt
@@ -1,8 +1,8 @@
package org.jetbrains.dokka
import org.jetbrains.jet.lang.resolve.BindingContext
-import org.jetbrains.jet.lang.psi.JetFile
import org.jetbrains.jet.lang.descriptors.*
+import org.jetbrains.jet.lang.resolve.name.FqName
public class DocumentationModule(val module: ModuleDescriptor) : DocumentationNode(module, "module", DocumentationContent.Empty, DocumentationNode.Kind.Module) {
fun merge(other: DocumentationModule): DocumentationModule {
@@ -13,15 +13,13 @@ public class DocumentationModule(val module: ModuleDescriptor) : DocumentationNo
}
}
-fun BindingContext.createDocumentationModule(module: ModuleDescriptor, file: JetFile): DocumentationModule {
- val packageFragment = getPackageFragment(file)
+fun BindingContext.createDocumentationModule(module: ModuleDescriptor, packages: Set<FqName>): DocumentationModule {
val documentationModule = DocumentationModule(module)
- if (packageFragment == null) throw IllegalArgumentException("File $file should have package fragment")
-
val visitor = DocumentationNodeBuilder(this)
- packageFragment.accept(DocumentationBuildingVisitor(this, visitor), documentationModule)
-
+ for (packageName in packages) {
+ val pkg = module.getPackage(packageName)
+ pkg!!.accept(DocumentationBuildingVisitor(this, visitor), documentationModule)
+ }
checkResolveChildren(documentationModule)
-
return documentationModule
}
diff --git a/src/Model/DocumentationNodeBuilder.kt b/src/Model/DocumentationNodeBuilder.kt
index f974ab11..8d75a45c 100644
--- a/src/Model/DocumentationNodeBuilder.kt
+++ b/src/Model/DocumentationNodeBuilder.kt
@@ -130,6 +130,12 @@ class DocumentationNodeBuilder(val context: BindingContext) : DeclarationDescrip
return node
}
+ override fun visitPackageViewDescriptor(descriptor: PackageViewDescriptor?, data: DocumentationNode?): DocumentationNode? {
+ val node = DocumentationNode(descriptor!!, descriptor.getFqName().asString(), DocumentationContent.Empty, DocumentationNode.Kind.Package)
+ reference(data!!, node, DocumentationReference.Kind.Member)
+ return node
+ }
+
override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor?, data: DocumentationNode?): DocumentationNode? {
val node = DocumentationNode(descriptor!!, descriptor.fqName.asString(), DocumentationContent.Empty, DocumentationNode.Kind.Package)
reference(data!!, node, DocumentationReference.Kind.Member)