diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 19:37:02 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 19:37:02 +0400 |
commit | 451b678c6bdff8b8242f299c600d100929a5171f (patch) | |
tree | 3c3352b54dcaf332c06aedcdbb11fb6ce0ac868e /src | |
parent | 73316ee2806eeb5144a43d170a0157ba7164a959 (diff) | |
download | dokka-451b678c6bdff8b8242f299c600d100929a5171f.tar.gz dokka-451b678c6bdff8b8242f299c600d100929a5171f.tar.bz2 dokka-451b678c6bdff8b8242f299c600d100929a5171f.zip |
Add processing of classes into model.
Diffstat (limited to 'src')
-rw-r--r-- | src/CommentsAPI.kt | 3 | ||||
-rw-r--r-- | src/DocumentationBuilder.kt | 6 | ||||
-rw-r--r-- | src/DocumentationBuildingVisitor.kt | 3 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/CommentsAPI.kt b/src/CommentsAPI.kt index fd281899..4d324d9d 100644 --- a/src/CommentsAPI.kt +++ b/src/CommentsAPI.kt @@ -7,7 +7,8 @@ import org.jetbrains.jet.lang.psi.JetDeclaration fun BindingContext.getDocumentation(descriptor: DeclarationDescriptor): KDoc? { val psiElement = DescriptorToSourceUtils.descriptorToDeclaration(descriptor) - if (psiElement == null) throw IllegalArgumentException("$descriptor doesn't have connection to source code, is it synthetic?") + if (psiElement == null) + throw IllegalArgumentException("$descriptor doesn't have connection to source code, is it synthetic?") return psiElement.previousSiblings().takeWhile { it !is JetDeclaration }.firstOrNull { it is KDoc } as KDoc? } diff --git a/src/DocumentationBuilder.kt b/src/DocumentationBuilder.kt index 26ed4f80..8b33e2b9 100644 --- a/src/DocumentationBuilder.kt +++ b/src/DocumentationBuilder.kt @@ -32,6 +32,12 @@ class DocumentationBuilderVisitor(val context : BindingContext) : DeclarationDes return node } + override fun visitClassDescriptor(descriptor: ClassDescriptor?, data: DocumentationNode?): DocumentationNode? { + val doc = context.getDocumentation(descriptor!!).extractText() + val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.Class) + data?.addReferenceTo(node, DocumentationReferenceKind.Member) + return node + } override fun visitFunctionDescriptor(descriptor: FunctionDescriptor?, data: DocumentationNode?): DocumentationNode? { val doc = context.getDocumentation(descriptor!!).extractText() diff --git a/src/DocumentationBuildingVisitor.kt b/src/DocumentationBuildingVisitor.kt index 6486ac90..4289a7f7 100644 --- a/src/DocumentationBuildingVisitor.kt +++ b/src/DocumentationBuildingVisitor.kt @@ -64,11 +64,10 @@ class DocumentationBuildingVisitor(private val worker: DeclarationDescriptorVisi public override fun visitClassDescriptor(descriptor: ClassDescriptor?, data: DocumentationNode?): DocumentationNode? { val node = createDocumentation(descriptor!!, data!!) - visitChildren(descriptor.getThisAsReceiverParameter(), node) visitChildren(descriptor.getConstructors(), node) visitChildren(descriptor.getTypeConstructor().getParameters(), node) visitChildren(descriptor.getClassObjectDescriptor(), node) - visitChildren(descriptor.getDefaultType().getMemberScope().getAllDescriptors(), node) + visitChildren(descriptor.getDefaultType().getMemberScope().getOwnDeclaredDescriptors(), node) return node } |