aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/DocumentationContext.kt
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-10-12 22:37:07 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-10-12 22:37:07 +0400
commit471039eeb5c1aca11076a17814debce59ac12dcc (patch)
tree4ad74ecf14fcbe62b87d9f48a3fc0f021a282eed /src/Kotlin/DocumentationContext.kt
parent11355cefc9f6856054cb3760d2a339f40d22dae3 (diff)
downloaddokka-471039eeb5c1aca11076a17814debce59ac12dcc.tar.gz
dokka-471039eeb5c1aca11076a17814debce59ac12dcc.tar.bz2
dokka-471039eeb5c1aca11076a17814debce59ac12dcc.zip
Remove obsolete code.
Diffstat (limited to 'src/Kotlin/DocumentationContext.kt')
-rw-r--r--src/Kotlin/DocumentationContext.kt60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/Kotlin/DocumentationContext.kt b/src/Kotlin/DocumentationContext.kt
deleted file mode 100644
index b13f08ea..00000000
--- a/src/Kotlin/DocumentationContext.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.jetbrains.dokka
-
-import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
-import org.jetbrains.jet.lang.resolve.BindingContext
-import org.jetbrains.jet.lang.resolve.scopes.JetScope
-import org.jetbrains.jet.lang.descriptors.ModuleDescriptor
-import org.jetbrains.jet.lang.resolve.name.FqName
-
-/**
- * Context for documentation generation.
- *
- * Holds information about relations between [nodes](DocumentationNode) and [descriptors](DeclarationDescriptor) during documentation generation
- *
- * $bindingContext: symbol resolution context
- */
-public class DocumentationContext(val bindingContext: BindingContext) {
- val descriptorToNode = hashMapOf<DeclarationDescriptor, DocumentationNode>()
- val nodeToDescriptor = hashMapOf<DocumentationNode, DeclarationDescriptor>()
-
- val relations = hashMapOf<DocumentationNode, DeclarationDescriptor>()
-
- fun attach(node: DocumentationNode, descriptor: DeclarationDescriptor) {
- relations.put(node, descriptor)
- }
-
- fun register(descriptor: DeclarationDescriptor, node: DocumentationNode) {
- descriptorToNode.put(descriptor, node)
- nodeToDescriptor.put(node, descriptor)
- }
-
- fun getResolutionScope(node: DocumentationNode): JetScope {
- val descriptor = nodeToDescriptor[node] ?: throw IllegalArgumentException("Node is not known to this context")
- return bindingContext.getResolutionScope(descriptor)
- }
-
- fun parseDocumentation(descriptor: DeclarationDescriptor): Content {
- val docText = bindingContext.getDocumentationElements(descriptor).map { it.extractText() }.join("\n")
- val tree = MarkdownProcessor.parse(docText)
- //println(tree.toTestString())
- val content = tree.toContent()
- return content
- }
-}
-
-fun BindingContext.createDocumentationModule(name: String,
- module: ModuleDescriptor,
- packages: Set<FqName>,
- options: DocumentationOptions = DocumentationOptions()): DocumentationModule {
- val documentationModule = DocumentationModule(name)
- val builder = DocumentationBuilder(this, options)
- with(builder) {
- for (packageName in packages) {
- val pkg = module.getPackage(packageName)
- if (pkg != null)
- documentationModule.appendChild(pkg, DocumentationReference.Kind.Member)
- }
- }
- builder.resolveReferences(documentationModule)
- return documentationModule
-}