aboutsummaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-09-29 20:54:59 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-09-29 20:54:59 +0400
commit778e2b3f7ff62971e18a49d81a8825e5dd894c2e (patch)
treef7fb9506800262ecabb9050ffee4a97e39812ccb /src/Model
parent2e3dc238275073a5c7a2e5a14c79337d12492dad (diff)
downloaddokka-778e2b3f7ff62971e18a49d81a8825e5dd894c2e.tar.gz
dokka-778e2b3f7ff62971e18a49d81a8825e5dd894c2e.tar.bz2
dokka-778e2b3f7ff62971e18a49d81a8825e5dd894c2e.zip
Extract content model, make doc model independent from descriptors, parse doccomments with custom parser, some tests failing due to hanging new lines.
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/Content.kt88
-rw-r--r--src/Model/Diagnostics.kt40
-rw-r--r--src/Model/DocumentationBuildingVisitor.kt121
-rw-r--r--src/Model/DocumentationContent.kt150
-rw-r--r--src/Model/DocumentationModule.kt23
-rw-r--r--src/Model/DocumentationNode.kt7
-rw-r--r--src/Model/DocumentationNodeBuilder.kt153
7 files changed, 92 insertions, 490 deletions
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
new file mode 100644
index 00000000..eb092cb2
--- /dev/null
+++ b/src/Model/Content.kt
@@ -0,0 +1,88 @@
+package org.jetbrains.dokka
+
+import kotlin.properties.Delegates
+
+public abstract class ContentNode {
+ val children = arrayListOf<ContentNode>()
+
+ class object {
+ val empty = ContentEmpty
+ }
+
+ fun isEmpty() = children.isEmpty()
+}
+
+public object ContentEmpty : ContentNode( )
+
+public class ContentText(val text : String) : ContentNode( )
+public class ContentBlock() : ContentNode( )
+public class ContentEmphasis() : ContentNode()
+public class ContentStrong() : ContentNode()
+public class ContentList() : ContentNode()
+public class ContentSection(public val label: String) : ContentNode()
+
+public class Content() : ContentNode() {
+ public val sections: Map<String, ContentSection> by Delegates.lazy {
+ val map = hashMapOf<String, ContentSection>()
+ for (child in children) {
+ if (child is ContentSection)
+ map.put(child.label, child)
+ }
+
+ if ("\$summary" !in map && "\$description" !in map) {
+ // no explicit summary and description, convert anonymous section
+ val anonymous = map[""]
+ if (anonymous != null) {
+ map.remove("")
+ val summary = ContentSection("\$summary")
+ val description = ContentSection("\$description")
+
+ val summaryNodes = anonymous.children.take(1)
+ val descriptionNodes = anonymous.children.drop(1)
+
+ if (summaryNodes.any()) {
+ summary.children.addAll(summaryNodes)
+ map.put("\$summary", summary)
+ }
+
+ if (descriptionNodes.any()) {
+ description.children.addAll(descriptionNodes)
+ map.put("\$description", description)
+ }
+ }
+ }
+ map
+ }
+
+ public val summary: ContentNode get() = sections["\$summary"] ?: ContentNode.empty
+ public val description: ContentNode get() = sections["\$description"] ?: ContentNode.empty
+
+ override fun equals(other: Any?): Boolean {
+ if (other !is Content)
+ return false
+ if (sections.size != other.sections.size)
+ return false
+ for (keys in sections.keySet())
+ if (sections[keys] != other.sections[keys])
+ return false
+
+ return true
+ }
+
+ override fun hashCode(): Int {
+ return sections.map { it.hashCode() }.sum()
+ }
+
+ override fun toString(): String {
+ if (sections.isEmpty())
+ return "<empty>"
+ return sections.values().joinToString()
+ }
+
+ val isEmpty: Boolean
+ get() = sections.none()
+
+ class object {
+ val Empty = Content()
+ }
+}
diff --git a/src/Model/Diagnostics.kt b/src/Model/Diagnostics.kt
deleted file mode 100644
index 1077da7c..00000000
--- a/src/Model/Diagnostics.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.jetbrains.dokka
-
-import org.jetbrains.jet.lang.descriptors.*
-import org.jetbrains.jet.lang.resolve.name.*
-import org.jetbrains.jet.lang.resolve.BindingContext
-
-fun BindingContext.checkResolveChildren(node: DocumentationNode) {
- if (node.kind != DocumentationNode.Kind.Module && node.kind != DocumentationNode.Kind.Package) {
- // TODO: we don't resolve packages and modules for now
-
- val parentScope = getResolutionScope(node.descriptor)
- for (item in node.details + node.members) {
- val symbolName = item.name
- val symbol: DeclarationDescriptor? = when (item.kind) {
- DocumentationNode.Kind.Modifier -> continue // do not resolve modifiers, they are not names
- DocumentationNode.Kind.Receiver -> continue // what is receiver's name in platform?
- DocumentationNode.Kind.Parameter -> parentScope.getLocalVariable(Name.guess(symbolName))
- DocumentationNode.Kind.Function -> parentScope.getFunctions(Name.guess(symbolName)).firstOrNull()
- DocumentationNode.Kind.Property -> parentScope.getProperties(Name.guess(symbolName)).firstOrNull()
- DocumentationNode.Kind.Constructor -> parentScope.getFunctions(Name.guess(symbolName)).firstOrNull()
- else -> parentScope.getClassifier(Name.guess(symbolName))
- }
-
- if (symbol == null)
- println("WARNING: Cannot resolve $item in ${path(node)}")
- }
- }
-
- for (reference in node.allReferences().filterNot { it.kind == DocumentationReference.Kind.Owner }) {
- checkResolveChildren(reference.to)
- }
-}
-
-fun path(node: DocumentationNode): String {
- val owner = node.owner
- if (owner != null)
- return "$node in ${path(owner)}"
- else
- return "$node"
-} \ No newline at end of file
diff --git a/src/Model/DocumentationBuildingVisitor.kt b/src/Model/DocumentationBuildingVisitor.kt
deleted file mode 100644
index 6118b0f5..00000000
--- a/src/Model/DocumentationBuildingVisitor.kt
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.jetbrains.dokka
-
-import org.jetbrains.jet.lang.descriptors.*
-import org.jetbrains.jet.lang.resolve.name.*
-import org.jetbrains.jet.lang.resolve.*
-
-public data class DocumentationOptions(val includeNonPublic : Boolean = false)
-class DocumentationBuildingVisitor(val context: BindingContext,
- val options: DocumentationOptions,
- private val worker: DeclarationDescriptorVisitor<DocumentationNode, DocumentationNode>)
-: DeclarationDescriptorVisitor<DocumentationNode, DocumentationNode> {
-
- private fun visitChildren(descriptors: Collection<DeclarationDescriptor>, data: DocumentationNode) {
- for (descriptor in descriptors) {
- visitChild(descriptor, data)
- }
- }
-
- private fun visitChild(descriptor: DeclarationDescriptor?, data: DocumentationNode) {
- if (descriptor != null && descriptor.isUserCode()) {
- if (options.includeNonPublic || descriptor !is MemberDescriptor || descriptor.getVisibility().isPublicAPI()) {
- descriptor.accept(this, data)
- }
- }
- }
-
- private fun createDocumentation(descriptor: DeclarationDescriptor, data: DocumentationNode): DocumentationNode {
- return descriptor.accept(worker, data)
- }
-
- private fun processCallable(descriptor: CallableDescriptor, data: DocumentationNode): DocumentationNode {
- val node = createDocumentation(descriptor, data)
- visitChildren(descriptor.getTypeParameters(), node)
- visitChild(descriptor.getReceiverParameter(), node)
- visitChildren(descriptor.getValueParameters(), node)
- return node
- }
-
- public override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = createDocumentation(descriptor!!, data!!)
- visitChildren(descriptor.getMemberScope().getAllDescriptors(), node)
- return node
- }
-
- public override fun visitPackageViewDescriptor(descriptor: PackageViewDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = createDocumentation(descriptor!!, data!!)
- visitChildren(descriptor.getMemberScope().getAllDescriptors(), node)
- return node
- }
-
- public override fun visitVariableDescriptor(descriptor: VariableDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = processCallable(descriptor!!, data!!)
- return node
- }
-
- public override fun visitPropertyDescriptor(descriptor: PropertyDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = processCallable(descriptor!!, data!!)
- visitChild(descriptor.getGetter(), node)
- visitChild(descriptor.getSetter(), node)
- return node
- }
-
- public override fun visitFunctionDescriptor(descriptor: FunctionDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = processCallable(descriptor!!, data!!)
- return node
- }
-
- public override fun visitTypeParameterDescriptor(descriptor: TypeParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = createDocumentation(descriptor!!, data!!)
- return node
- }
-
- public override fun visitClassDescriptor(descriptor: ClassDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = createDocumentation(descriptor!!, data!!)
- if (descriptor.getKind() != ClassKind.OBJECT) {
- // do not go inside object for class object and constructors, they are generated
- visitChildren(descriptor.getTypeConstructor().getParameters(), node)
- visitChildren(descriptor.getConstructors(), node)
- visitChild(descriptor.getClassObjectDescriptor(), node)
- }
- visitChildren(descriptor.getDefaultType().getMemberScope().getAllDescriptors(), node)
- return node
- }
-
- public override fun visitModuleDeclaration(descriptor: ModuleDescriptor, data: DocumentationNode): DocumentationNode {
- val node = createDocumentation(descriptor, data)
- visitChild(descriptor.getPackage(FqName.ROOT), node)
- return node
- }
-
- public override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = visitFunctionDescriptor(descriptor!!, data)
- return node
- }
-
- public override fun visitScriptDescriptor(scriptDescriptor: ScriptDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val classDescriptor = scriptDescriptor!!.getClassDescriptor()
- val node = visitClassDescriptor(classDescriptor, data)
- return node
- }
-
- public override fun visitValueParameterDescriptor(descriptor: ValueParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = visitVariableDescriptor(descriptor!!, data)
- return node
- }
-
- public override fun visitPropertyGetterDescriptor(descriptor: PropertyGetterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = visitFunctionDescriptor(descriptor!!, data)
- return node
- }
-
- public override fun visitPropertySetterDescriptor(descriptor: PropertySetterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = visitFunctionDescriptor(descriptor!!, data)
- return node
- }
-
- public override fun visitReceiverParameterDescriptor(descriptor: ReceiverParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = createDocumentation(descriptor!!, data!!)
- return node
- }
-}
diff --git a/src/Model/DocumentationContent.kt b/src/Model/DocumentationContent.kt
deleted file mode 100644
index 77e8c764..00000000
--- a/src/Model/DocumentationContent.kt
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.jetbrains.dokka
-
-import org.jetbrains.jet.lang.descriptors.*
-import org.jetbrains.jet.lang.resolve.BindingContext
-
-public class DocumentationContentSection(public val label: String, public val text: RichString) {
- override fun toString(): String {
- return "$label = $text"
- }
-}
-
-public class DocumentationContent(public val sections: Map<String, DocumentationContentSection>) {
-
- public val summary: RichString get() = sections["\$summary"]?.text ?: RichString.empty
- public val description: RichString get() = sections["\$description"]?.text ?: RichString.empty
-
- override fun equals(other: Any?): Boolean {
- if (other !is DocumentationContent)
- return false
- if (sections.size != other.sections.size)
- return false
- for (keys in sections.keySet())
- if (sections[keys] != other.sections[keys])
- return false
-
- return true
- }
-
- override fun hashCode(): Int {
- return sections.map { it.hashCode() }.sum()
- }
-
- override fun toString(): String {
- if (sections.isEmpty())
- return "<empty>"
- return sections.values().joinToString()
- }
-
- val isEmpty: Boolean
- get() = description.isEmpty() && sections.none()
-
- class object {
- val Empty = DocumentationContent(mapOf())
- }
-}
-
-
-fun BindingContext.getDocumentation(descriptor: DeclarationDescriptor): DocumentationContent {
- val docText = getDocumentationElements(descriptor).map { it.extractText() }.join("\n")
- val sections = docText.parseSections()
- sections.createSummaryAndDescription()
- return DocumentationContent(sections)
-}
-
-fun MutableMap<String, DocumentationContentSection>.createSummaryAndDescription() {
-
- val summary = get("\$summary")
- val description = get("\$description")
- if (summary != null && description == null) {
- return
- }
-
- if (summary == null && description != null) {
- return
- }
-
- val unnamed = get("")
- if (unnamed == null) {
- return
- }
-
- val split = unnamed.text.splitBy("\n")
- remove("")
- if (!split.first.isEmpty())
- put("\$summary", DocumentationContentSection("\$summary", split.first))
- if (!split.second.isEmpty())
- put("\$description", DocumentationContentSection("\$description", split.second))
-}
-
-fun String.parseLabel(index: Int): Pair<String, Int> {
- val c = get(index)
- when {
- Character.isJavaIdentifierStart(c) -> {
- for (end in index + 1..length - 1) {
- if (!Character.isJavaIdentifierPart(get(end))) {
- return substring(index, end) to end
- }
- }
- return substring(index, length) to length
- }
- c == '$' -> {
- for (end in index + 1..length - 1) {
- if (Character.isWhitespace(get(end))) {
- return substring(index, end) to end
- }
- }
- return substring(index, length) to length
- }
- c == '{' -> {
- val end = indexOf('}', index + 1)
- return substring(index + 1, end) to end + 1
- }
- }
- return "" to -1
-}
-
-fun String.parseSections(): MutableMap<String, DocumentationContentSection> {
- val sections = hashMapOf<String, DocumentationContentSection>()
- var currentLabel = ""
- var currentSectionStart = 0
- var currentIndex = 0
-
- while (currentIndex < length) {
- if (get(currentIndex) == '$') {
- val (label, index) = parseLabel(currentIndex + 1)
- if (index != -1 && index < length() && get(index) == ':') {
- // section starts, add previous section
- val currentContent = substring(currentSectionStart, currentIndex).trim()
- val section = DocumentationContentSection(currentLabel, currentContent.toRichString())
- sections.put(section.label, section)
-
- currentLabel = label
- currentIndex = index + 1
- currentSectionStart = currentIndex
- continue
- }
- }
- currentIndex++
-
- }
-
- val currentContent = substring(currentSectionStart, currentIndex).trim()
- val section = DocumentationContentSection(currentLabel, currentContent.toRichString())
- sections.put(section.label, section)
- return sections
-}
-
-fun String.toRichString() : RichString {
- val content = RichString()
- for(index in indices) {
- val ch = get(index)
- when {
- ch == '\\' -> continue
- ch == '*' && index < length-1 && !get(index + 1).isWhitespace() -> ch
- }
- }
-
- content.addSlice(this, NormalStyle)
- return content
-} \ No newline at end of file
diff --git a/src/Model/DocumentationModule.kt b/src/Model/DocumentationModule.kt
index 78ebda04..6084ea5e 100644
--- a/src/Model/DocumentationModule.kt
+++ b/src/Model/DocumentationModule.kt
@@ -1,30 +1,11 @@
package org.jetbrains.dokka
-import org.jetbrains.jet.lang.resolve.BindingContext
-import org.jetbrains.jet.lang.descriptors.*
-import org.jetbrains.jet.lang.resolve.name.FqName
-
-public class DocumentationModule(name: String, val module: ModuleDescriptor) : DocumentationNode(module, name, DocumentationContent.Empty, DocumentationNode.Kind.Module) {
+public class DocumentationModule(name: String) : DocumentationNode(name, Content.Empty, DocumentationNode.Kind.Module) {
fun merge(other: DocumentationModule): DocumentationModule {
- val model = DocumentationModule(name, module)
+ val model = DocumentationModule(name)
model.addAllReferencesFrom(other)
model.addAllReferencesFrom(this)
return model
}
}
-fun BindingContext.createDocumentationModule(name: String,
- module: ModuleDescriptor,
- packages: Set<FqName>,
- options : DocumentationOptions = DocumentationOptions()): DocumentationModule {
- val documentationModule = DocumentationModule(name, module)
- val visitor = DocumentationNodeBuilder(this)
- for (packageName in packages) {
- val pkg = module.getPackage(packageName)
- pkg!!.accept(DocumentationBuildingVisitor(this, options, visitor), documentationModule)
- }
-
- // TODO: Uncomment for resolve verification
- // checkResolveChildren(documentationModule)
- return documentationModule
-}
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index c96c383d..198e549b 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -1,12 +1,9 @@
package org.jetbrains.dokka
-import org.jetbrains.jet.lang.descriptors.*
import java.util.LinkedHashSet
-
-public open class DocumentationNode(val descriptor: DeclarationDescriptor,
- val name: String,
- val doc: DocumentationContent,
+public open class DocumentationNode(val name: String,
+ val doc: Content,
val kind: DocumentationNode.Kind) {
private val references = LinkedHashSet<DocumentationReference>()
diff --git a/src/Model/DocumentationNodeBuilder.kt b/src/Model/DocumentationNodeBuilder.kt
deleted file mode 100644
index f724c444..00000000
--- a/src/Model/DocumentationNodeBuilder.kt
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.jetbrains.dokka
-
-import org.jetbrains.jet.lang.resolve.*
-import org.jetbrains.jet.lang.descriptors.*
-import org.jetbrains.jet.lang.descriptors.impl.*
-import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
-import org.jetbrains.jet.lang.types.JetType
-
-class DocumentationNodeBuilder(val context: BindingContext) : DeclarationDescriptorVisitorEmptyBodies<DocumentationNode, DocumentationNode>() {
-
- fun reference(from: DocumentationNode, to: DocumentationNode, kind: DocumentationReference.Kind) {
- from.addReferenceTo(to, kind)
- if (kind == DocumentationReference.Kind.Link)
- to.addReferenceTo(from, DocumentationReference.Kind.Link)
- else
- to.addReferenceTo(from, DocumentationReference.Kind.Owner)
- }
-
- fun addModality(descriptor: MemberDescriptor, data: DocumentationNode) {
- val modifier = descriptor.getModality().name().toLowerCase()
- val node = DocumentationNode(descriptor, modifier, DocumentationContent.Empty, DocumentationNode.Kind.Modifier)
- reference(data, node, DocumentationReference.Kind.Detail)
- }
-
- fun addVisibility(descriptor: MemberDescriptor, data: DocumentationNode) {
- val modifier = descriptor.getVisibility().toString()
- val node = DocumentationNode(descriptor, modifier, DocumentationContent.Empty, DocumentationNode.Kind.Modifier)
- reference(data, node, DocumentationReference.Kind.Detail)
- }
-
- fun addType(descriptor: DeclarationDescriptor, t: JetType?, data: DocumentationNode) {
- if (t == null)
- return
- val typeConstructor = t.getConstructor()
- val classifierDescriptor = typeConstructor.getDeclarationDescriptor()
- val name = when (classifierDescriptor) {
- is Named -> classifierDescriptor.getName().asString()
- else -> "<anonymous>"
- }
- val node = DocumentationNode(descriptor, name, DocumentationContent.Empty, DocumentationNode.Kind.Type)
- reference(data, node, DocumentationReference.Kind.Detail)
-
- for (param in t.getArguments())
- addType(descriptor, param.getType(), node)
- }
-
- override fun visitDeclarationDescriptor(descriptor: DeclarationDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Unknown)
- reference(data!!, node, DocumentationReference.Kind.Link)
- return node
- }
-
- override fun visitReceiverParameterDescriptor(descriptor: ReceiverParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = DocumentationNode(descriptor!!, descriptor.getName().asString(), DocumentationContent.Empty, DocumentationNode.Kind.Receiver)
- reference(data!!, node, DocumentationReference.Kind.Detail)
-
- addType(descriptor, descriptor.getType(), node)
-
- return node
- }
-
- override fun visitValueParameterDescriptor(descriptor: ValueParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Parameter)
- reference(data!!, node, DocumentationReference.Kind.Detail)
-
- addType(descriptor, descriptor.getType(), node)
-
- return node
- }
-
- override fun visitClassDescriptor(descriptor: ClassDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, when (descriptor.getKind()) {
- ClassKind.OBJECT -> DocumentationNode.Kind.Object
- ClassKind.CLASS_OBJECT -> DocumentationNode.Kind.Object
- ClassKind.TRAIT -> DocumentationNode.Kind.Interface
- ClassKind.ENUM_CLASS -> DocumentationNode.Kind.Enum
- ClassKind.ENUM_ENTRY -> DocumentationNode.Kind.EnumItem
- else -> DocumentationNode.Kind.Class
- })
- reference(data!!, node, DocumentationReference.Kind.Member)
- addModality(descriptor, node)
- addVisibility(descriptor, node)
- return node
- }
-
- override fun visitFunctionDescriptor(descriptor: FunctionDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Function)
- reference(data!!, node, DocumentationReference.Kind.Member)
-
- addType(descriptor, descriptor.getReturnType(), node)
- addModality(descriptor, node)
- addVisibility(descriptor, node)
-
- return node
- }
-
- override fun visitTypeParameterDescriptor(descriptor: TypeParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.TypeParameter)
- reference(data!!, node, DocumentationReference.Kind.Detail)
- val builtIns = KotlinBuiltIns.getInstance()
- for (constraint in descriptor.getUpperBounds()) {
- if (constraint == builtIns.getDefaultBound())
- continue
- val constraintNode = DocumentationNode(descriptor, constraint.toString(), DocumentationContent.Empty, DocumentationNode.Kind.UpperBound)
- reference(node, constraintNode, DocumentationReference.Kind.Detail)
- }
- for (constraint in descriptor.getLowerBounds()) {
- if (builtIns.isNothing(constraint))
- continue
- val constraintNode = DocumentationNode(descriptor, constraint.toString(), DocumentationContent.Empty, DocumentationNode.Kind.LowerBound)
- reference(node, constraintNode, DocumentationReference.Kind.Detail)
- }
- return node
- }
-
- override fun visitPropertyDescriptor(descriptor: PropertyDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Property)
- reference(data!!, node, DocumentationReference.Kind.Member)
-
- addType(descriptor, descriptor.getType(), node)
- addModality(descriptor, node)
- addVisibility(descriptor, node)
- return node
- }
-
- override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Constructor)
- reference(data!!, node, DocumentationReference.Kind.Member)
-
- addVisibility(descriptor, node)
-
- return node
- }
-
- override fun visitPackageViewDescriptor(descriptor: PackageViewDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = DocumentationNode(descriptor!!, descriptor.getFqName().asString(), DocumentationContent.Empty, DocumentationNode.Kind.Package)
- reference(data!!, node, DocumentationReference.Kind.Member)
- return node
- }
-
- override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = DocumentationNode(descriptor!!, descriptor.fqName.asString(), DocumentationContent.Empty, DocumentationNode.Kind.Package)
- reference(data!!, node, DocumentationReference.Kind.Member)
- return node
- }
-}