From 1cb3af902c8f2e3f73e7c78781373f1ab5788772 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Mon, 13 Oct 2014 20:14:45 +0400 Subject: Remove BindingContext and migrate to ResolveSession, discover symbols for {code ...} directive. --- src/Kotlin/DocumentationBuilder.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Kotlin/DocumentationBuilder.kt') diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index b18902e4..cee374d9 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -11,10 +11,11 @@ import org.jetbrains.jet.lang.resolve.name.Name import org.jetbrains.jet.lang.resolve.scopes.JetScope import org.jetbrains.jet.lang.psi.JetFile import org.jetbrains.jet.lang.resolve.name.FqName +import org.jetbrains.jet.lang.resolve.lazy.ResolveSession public data class DocumentationOptions(val includeNonPublic: Boolean = false) -class DocumentationBuilder(val context: BindingContext, val options: DocumentationOptions) { +class DocumentationBuilder(val session: ResolveSession, val options: DocumentationOptions) { val visibleToDocumentation = setOf(Visibilities.INTERNAL, Visibilities.PROTECTED, Visibilities.PUBLIC) val descriptorToNode = hashMapOf() val nodeToDescriptor = hashMapOf() @@ -22,7 +23,7 @@ class DocumentationBuilder(val context: BindingContext, val options: Documentati val packages = hashMapOf() fun parseDocumentation(descriptor: DeclarationDescriptor): Content { - val docText = context.getDocumentationElements(descriptor).map { it.extractText() }.join("\n") + val docText = descriptor.getDocumentationElements().map { it.extractText() }.join("\n") val tree = MarkdownProcessor.parse(docText) //println(tree.toTestString()) val content = buildContent(tree, descriptor) @@ -295,7 +296,7 @@ class DocumentationBuilder(val context: BindingContext, val options: Documentati fun getResolutionScope(node: DocumentationNode): JetScope { val descriptor = nodeToDescriptor[node] ?: throw IllegalArgumentException("Node is not known to this context") - return context.getResolutionScope(descriptor) + return getResolutionScope(descriptor) } fun resolveContentLinks(node: DocumentationNode, content: ContentNode) { -- cgit