blob: 1f30268e074d598377c52a0e649a3efd28a98843 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package org.jetbrains.dokka
import org.jetbrains.jet.lang.resolve.BindingContext
import org.jetbrains.jet.lang.psi.JetFile
import org.jetbrains.jet.lang.descriptors.*
public class DocumentationModule(val module: ModuleDescriptor) : DocumentationNode(module, "module", DocumentationContent.Empty, DocumentationNode.Kind.Module) {
fun merge(other: DocumentationModule): DocumentationModule {
val model = DocumentationModule(module)
model.addAllReferencesFrom(other)
model.addAllReferencesFrom(this)
return model
}
}
fun BindingContext.createDocumentationModule(module: ModuleDescriptor, file: JetFile): DocumentationModule {
val packageFragment = getPackageFragment(file)
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)
checkResolveChildren(documentationModule)
return documentationModule
}
|