diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 20:54:26 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 20:54:26 +0400 |
commit | 197a6e486d16d2e3689e900b45c65ef8d598f3b7 (patch) | |
tree | 5b4443a4406dd0fff9a549e8fc51e61d8f2ef06a /src/Documentation/DocumentationBuilder.kt | |
parent | 6afd7af76563f373e971256f8c9a7dcf42183fd4 (diff) | |
download | dokka-197a6e486d16d2e3689e900b45c65ef8d598f3b7.tar.gz dokka-197a6e486d16d2e3689e900b45c65ef8d598f3b7.tar.bz2 dokka-197a6e486d16d2e3689e900b45c65ef8d598f3b7.zip |
Rename Documentation folder to Model
Diffstat (limited to 'src/Documentation/DocumentationBuilder.kt')
-rw-r--r-- | src/Documentation/DocumentationBuilder.kt | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/Documentation/DocumentationBuilder.kt b/src/Documentation/DocumentationBuilder.kt deleted file mode 100644 index 77f74eb2..00000000 --- a/src/Documentation/DocumentationBuilder.kt +++ /dev/null @@ -1,73 +0,0 @@ -package org.jetbrains.dokka - -import org.jetbrains.jet.lang.resolve.* -import org.jetbrains.jet.lang.psi.* -import org.jetbrains.jet.lang.descriptors.* -import org.jetbrains.jet.lang.descriptors.impl.* - -fun BindingContext.createDocumentation(file: JetFile): DocumentationModel { - val model = DocumentationModel() - val packageFragment = getPackageFragment(file) - if (packageFragment == null) throw IllegalArgumentException("File $file should have package fragment") - - val visitor = DocumentationBuilderVisitor(this) - visitDescriptor(packageFragment, model, visitor) - - return model -} - -class DocumentationBuilderVisitor(val context: BindingContext) : DeclarationDescriptorVisitorEmptyBodies<DocumentationNode, DocumentationNode>() { - - override fun visitDeclarationDescriptor(descriptor: DeclarationDescriptor?, data: DocumentationNode?): DocumentationNode? { - val doc = context.getDocumentation(descriptor!!).extractText() - val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.Unknown) - data?.addReferenceTo(node, DocumentationReferenceKind.Member) - return node - } - - override fun visitValueParameterDescriptor(descriptor: ValueParameterDescriptor?, data: DocumentationNode?): DocumentationNode? { - val doc = context.getDocumentation(descriptor!!).extractText() - val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.Parameter) - data?.addReferenceTo(node, DocumentationReferenceKind.Detail) - return node - } - - override fun visitClassDescriptor(descriptor: ClassDescriptor?, data: DocumentationNode?): DocumentationNode? { - val doc = context.getDocumentation(descriptor!!).extractText() - val node = DocumentationNode(descriptor.getName().asString(), doc, - when (descriptor.getKind()) { - ClassKind.OBJECT -> DocumentationNodeKind.Object - else -> DocumentationNodeKind.Class - } - ) - data?.addReferenceTo(node, DocumentationReferenceKind.Member) - return node - } - - override fun visitFunctionDescriptor(descriptor: FunctionDescriptor?, data: DocumentationNode?): DocumentationNode? { - val doc = context.getDocumentation(descriptor!!).extractText() - val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.Function) - data?.addReferenceTo(node, DocumentationReferenceKind.Member) - return node - } - - override fun visitPropertyDescriptor(descriptor: PropertyDescriptor?, data: DocumentationNode?): DocumentationNode? { - val doc = context.getDocumentation(descriptor!!).extractText() - val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.Property) - data?.addReferenceTo(node, DocumentationReferenceKind.Member) - return node - } - - override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor?, data: DocumentationNode?): DocumentationNode? { - val doc = context.getDocumentation(descriptor!!).extractText() - val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.Constructor) - data?.addReferenceTo(node, DocumentationReferenceKind.Member) - return node - } - - override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor?, data: DocumentationNode?): DocumentationNode? { - val node = DocumentationNode(descriptor!!.fqName.asString(), "", DocumentationNodeKind.Package) - data?.addReferenceTo(node, DocumentationReferenceKind.Member) - return node - } -} |