aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-12 15:14:03 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-12 15:14:03 +0400
commit52deaf7d9b31a4cc5ed36a280e07fdfeff975362 (patch)
tree7864aa9cd01a8d7c793246c6d993747577bdab3b
parent9ebe89742ccf29bb7efb6198666bd968397320e0 (diff)
downloaddokka-52deaf7d9b31a4cc5ed36a280e07fdfeff975362.tar.gz
dokka-52deaf7d9b31a4cc5ed36a280e07fdfeff975362.tar.bz2
dokka-52deaf7d9b31a4cc5ed36a280e07fdfeff975362.zip
Add signature generator classes, refactor classes into files and nested enums.
-rw-r--r--src/Generation/KotlinSignatureGenerator.kt7
-rw-r--r--src/Generation/SignatureGenerator.kt6
-rw-r--r--src/Model/Diagnostics.kt14
-rw-r--r--src/Model/DocumentationModule.kt78
-rw-r--r--src/Model/DocumentationNode.kt63
-rw-r--r--src/Model/DocumentationNodeBuilder.kt82
-rw-r--r--src/Model/DocumentationReference.kt14
-rw-r--r--src/main.kt2
-rw-r--r--test/src/TestAPI.kt2
-rw-r--r--test/src/model/ClassTest.kt24
-rw-r--r--test/src/model/FunctionTest.kt22
-rw-r--r--test/src/model/PackageTest.kt10
-rw-r--r--test/src/model/PropertyTest.kt16
13 files changed, 182 insertions, 158 deletions
diff --git a/src/Generation/KotlinSignatureGenerator.kt b/src/Generation/KotlinSignatureGenerator.kt
new file mode 100644
index 00000000..fad655b0
--- /dev/null
+++ b/src/Generation/KotlinSignatureGenerator.kt
@@ -0,0 +1,7 @@
+package org.jetbrains.dokka
+
+class KotlinSignatureGenerator : SignatureGenerator {
+ override fun getFunctionSignature(node: DocumentationNode): String {
+ return node.name
+ }
+} \ No newline at end of file
diff --git a/src/Generation/SignatureGenerator.kt b/src/Generation/SignatureGenerator.kt
new file mode 100644
index 00000000..2f603327
--- /dev/null
+++ b/src/Generation/SignatureGenerator.kt
@@ -0,0 +1,6 @@
+package org.jetbrains.dokka
+
+trait SignatureGenerator {
+ fun getFunctionSignature(node: DocumentationNode): String
+}
+
diff --git a/src/Model/Diagnostics.kt b/src/Model/Diagnostics.kt
index 723bd59d..470d7973 100644
--- a/src/Model/Diagnostics.kt
+++ b/src/Model/Diagnostics.kt
@@ -5,18 +5,18 @@ import org.jetbrains.jet.lang.resolve.name.*
import org.jetbrains.jet.lang.resolve.BindingContext
fun BindingContext.checkResolveChildren(node : DocumentationNode) {
- if (node.kind != DocumentationNodeKind.Module && node.kind != DocumentationNodeKind.Package) {
+ 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) {
- DocumentationNodeKind.Receiver -> (parentScope.getContainingDeclaration() as FunctionDescriptor).getReceiverParameter()
- DocumentationNodeKind.Parameter -> parentScope.getLocalVariable(Name.guess(symbolName))
- DocumentationNodeKind.Function -> parentScope.getFunctions(Name.guess(symbolName)).firstOrNull()
- DocumentationNodeKind.Property -> parentScope.getProperties(Name.guess(symbolName)).firstOrNull()
- DocumentationNodeKind.Constructor -> parentScope.getFunctions(Name.guess(symbolName)).firstOrNull()
+ DocumentationNode.Kind.Receiver -> (parentScope.getContainingDeclaration() as FunctionDescriptor).getReceiverParameter()
+ 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))
}
@@ -25,7 +25,7 @@ fun BindingContext.checkResolveChildren(node : DocumentationNode) {
}
}
- for (reference in node.allReferences().filterNot { it.kind == DocumentationReferenceKind.Owner }) {
+ for (reference in node.allReferences().filterNot { it.kind == DocumentationReference.Kind.Owner }) {
checkResolveChildren(reference.to)
}
}
diff --git a/src/Model/DocumentationModule.kt b/src/Model/DocumentationModule.kt
index 49a54624..25cbb600 100644
--- a/src/Model/DocumentationModule.kt
+++ b/src/Model/DocumentationModule.kt
@@ -4,71 +4,7 @@ import org.jetbrains.jet.lang.resolve.BindingContext
import org.jetbrains.jet.lang.psi.JetFile
import org.jetbrains.jet.lang.descriptors.*
-public enum class DocumentationNodeKind {
- Unknown
-
- Package
- Class
- Trait
- Object
-
- Constructor
- Function
- Property
-
- Parameter
- Receiver
- TypeParameter
- Type
- UpperBound
- LowerBound
- Exception
-
- Module
-}
-
-public enum class DocumentationReferenceKind {
- Owner
- Member
- Detail
- Link
- Override
-}
-
-public open class DocumentationNode(val descriptor: DeclarationDescriptor,
- val name: String,
- val doc: DocumentationContent,
- val kind: DocumentationNodeKind) {
-
- private val references = arrayListOf<DocumentationReference>()
-
- public val owner: DocumentationNode?
- get() = references(DocumentationReferenceKind.Owner).firstOrNull()?.to // TODO: should be singleOrNull, but bugz!
- public val details: List<DocumentationNode>
- get() = references(DocumentationReferenceKind.Detail).map { it.to }
- public val members: List<DocumentationNode>
- get() = references(DocumentationReferenceKind.Member).map { it.to }
- public val links: List<DocumentationNode>
- get() = references(DocumentationReferenceKind.Link).map { it.to }
-
- // TODO: Should we allow node mutation? Model merge will copy by ref, so references are transparent, which could nice
- public fun addReferenceTo(to: DocumentationNode, kind: DocumentationReferenceKind) {
- references.add(DocumentationReference(this, to, kind))
- }
-
- public fun addAllReferencesFrom(other: DocumentationNode) {
- references.addAll(other.references)
- }
-
- public fun references(kind: DocumentationReferenceKind): List<DocumentationReference> = references.filter { it.kind == kind }
- public fun allReferences(): List<DocumentationReference> = references
-
- public override fun toString(): String {
- return "$kind:$name"
- }
-}
-
-public class DocumentationModule(val module: ModuleDescriptor) : DocumentationNode(module, "model", DocumentationContent.Empty, DocumentationNodeKind.Module) {
+public class DocumentationModule(val module: ModuleDescriptor) : DocumentationNode(module, "model", DocumentationContent.Empty, DocumentationNode.Kind.Module) {
fun merge(other: DocumentationModule): DocumentationModule {
val model = DocumentationModule(module)
model.addAllReferencesFrom(other)
@@ -77,17 +13,15 @@ public class DocumentationModule(val module: ModuleDescriptor) : DocumentationNo
}
}
-public data class DocumentationReference(val from: DocumentationNode, val to: DocumentationNode, val kind: DocumentationReferenceKind)
-
-fun BindingContext.createDocumentationModel(module: ModuleDescriptor, file: JetFile): DocumentationModule {
+fun BindingContext.createDocumentationModule(module: ModuleDescriptor, file: JetFile): DocumentationModule {
val packageFragment = getPackageFragment(file)
- val model = DocumentationModule(module)
+ val documentationModule = DocumentationModule(module)
if (packageFragment == null) throw IllegalArgumentException("File $file should have package fragment")
val visitor = DocumentationNodeBuilder(this)
- packageFragment.accept(DocumentationBuildingVisitor(this, visitor), model)
+ packageFragment.accept(DocumentationBuildingVisitor(this, visitor), documentationModule)
- checkResolveChildren(model)
+ checkResolveChildren(documentationModule)
- return model
+ return documentationModule
}
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
new file mode 100644
index 00000000..f095e8b0
--- /dev/null
+++ b/src/Model/DocumentationNode.kt
@@ -0,0 +1,63 @@
+package org.jetbrains.dokka
+
+import org.jetbrains.jet.lang.descriptors.*
+
+
+public open class DocumentationNode(val descriptor: DeclarationDescriptor,
+ val name: String,
+ val doc: DocumentationContent,
+ val kind: DocumentationNode.Kind) {
+
+ private val references = arrayListOf<DocumentationReference>()
+
+ public val owner: DocumentationNode?
+ get() = references(DocumentationReference.Kind.Owner).firstOrNull()?.to // TODO: should be singleOrNull, but bugz!
+ public val details: List<DocumentationNode>
+ get() = references(DocumentationReference.Kind.Detail).map { it.to }
+ public val members: List<DocumentationNode>
+ get() = references(DocumentationReference.Kind.Member).map { it.to }
+ public val links: List<DocumentationNode>
+ get() = references(DocumentationReference.Kind.Link).map { it.to }
+
+ // TODO: Should we allow node mutation? Model merge will copy by ref, so references are transparent, which could nice
+ public fun addReferenceTo(to: DocumentationNode, kind: DocumentationReference.Kind) {
+ references.add(DocumentationReference(this, to, kind))
+ }
+
+ public fun addAllReferencesFrom(other: DocumentationNode) {
+ references.addAll(other.references)
+ }
+
+ public fun references(kind: DocumentationReference.Kind): List<DocumentationReference> = references.filter { it.kind == kind }
+ public fun allReferences(): List<DocumentationReference> = references
+
+ public override fun toString(): String {
+ return "$kind:$name"
+ }
+
+ public enum class Kind {
+ Unknown
+
+ Package
+ Class
+ Trait
+ Object
+
+ Constructor
+ Function
+ Property
+
+ Parameter
+ Receiver
+ TypeParameter
+ Type
+ UpperBound
+ LowerBound
+ Exception
+
+ Module
+ }
+
+}
+
+
diff --git a/src/Model/DocumentationNodeBuilder.kt b/src/Model/DocumentationNodeBuilder.kt
index b079c499..8fa12012 100644
--- a/src/Model/DocumentationNodeBuilder.kt
+++ b/src/Model/DocumentationNodeBuilder.kt
@@ -10,104 +10,104 @@ class DocumentationNodeBuilder(val context: BindingContext) : DeclarationDescrip
override fun visitDeclarationDescriptor(descriptor: DeclarationDescriptor?, data: DocumentationNode?): DocumentationNode? {
val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNodeKind.Unknown)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Link)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Unknown)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Link)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
override fun visitReceiverParameterDescriptor(descriptor: ReceiverParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = DocumentationNode(descriptor!!, descriptor.getName().asString(), DocumentationContent.Empty, DocumentationNodeKind.Receiver)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Detail)
+ val node = DocumentationNode(descriptor!!, descriptor.getName().asString(), DocumentationContent.Empty, DocumentationNode.Kind.Receiver)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Detail)
- val typeNode = DocumentationNode(descriptor, descriptor.getType().toString(), DocumentationContent.Empty, DocumentationNodeKind.Type)
- node.addReferenceTo(typeNode, DocumentationReferenceKind.Detail)
+ val typeNode = DocumentationNode(descriptor, descriptor.getType().toString(), DocumentationContent.Empty, DocumentationNode.Kind.Type)
+ node.addReferenceTo(typeNode, DocumentationReference.Kind.Detail)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
override fun visitValueParameterDescriptor(descriptor: ValueParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNodeKind.Parameter)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Detail)
+ val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Parameter)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Detail)
- val typeNode = DocumentationNode(descriptor, descriptor.getType().toString(), DocumentationContent.Empty, DocumentationNodeKind.Type)
- node.addReferenceTo(typeNode, DocumentationReferenceKind.Detail)
+ val typeNode = DocumentationNode(descriptor, descriptor.getType().toString(), DocumentationContent.Empty, DocumentationNode.Kind.Type)
+ node.addReferenceTo(typeNode, DocumentationReference.Kind.Detail)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
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 -> DocumentationNodeKind.Object
- ClassKind.TRAIT -> DocumentationNodeKind.Trait
- else -> DocumentationNodeKind.Class
+ ClassKind.OBJECT -> DocumentationNode.Kind.Object
+ ClassKind.TRAIT -> DocumentationNode.Kind.Trait
+ else -> DocumentationNode.Kind.Class
})
- data!!.addReferenceTo(node, DocumentationReferenceKind.Member)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Member)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
override fun visitFunctionDescriptor(descriptor: FunctionDescriptor?, data: DocumentationNode?): DocumentationNode? {
val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNodeKind.Function)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Member)
+ val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Function)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Member)
- val typeNode = DocumentationNode(descriptor, descriptor.getReturnType().toString(), DocumentationContent.Empty, DocumentationNodeKind.Type)
- node.addReferenceTo(typeNode, DocumentationReferenceKind.Detail)
+ val typeNode = DocumentationNode(descriptor, descriptor.getReturnType().toString(), DocumentationContent.Empty, DocumentationNode.Kind.Type)
+ node.addReferenceTo(typeNode, DocumentationReference.Kind.Detail)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
override fun visitTypeParameterDescriptor(descriptor: TypeParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNodeKind.TypeParameter)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Detail)
+ val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.TypeParameter)
+ data!!.addReferenceTo(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, DocumentationNodeKind.UpperBound)
- node.addReferenceTo(constraintNode, DocumentationReferenceKind.Detail)
+ val constraintNode = DocumentationNode(descriptor, constraint.toString(), DocumentationContent.Empty, DocumentationNode.Kind.UpperBound)
+ node.addReferenceTo(constraintNode, DocumentationReference.Kind.Detail)
}
for (constraint in descriptor.getLowerBounds()) {
if (builtIns.isNothing(constraint))
continue
- val constraintNode = DocumentationNode(descriptor, constraint.toString(), DocumentationContent.Empty, DocumentationNodeKind.LowerBound)
- node.addReferenceTo(constraintNode, DocumentationReferenceKind.Detail)
+ val constraintNode = DocumentationNode(descriptor, constraint.toString(), DocumentationContent.Empty, DocumentationNode.Kind.LowerBound)
+ node.addReferenceTo(constraintNode, DocumentationReference.Kind.Detail)
}
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
override fun visitPropertyDescriptor(descriptor: PropertyDescriptor?, data: DocumentationNode?): DocumentationNode? {
val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNodeKind.Property)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Member)
+ val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Property)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Member)
- val typeNode = DocumentationNode(descriptor, descriptor.getType().toString(), DocumentationContent.Empty, DocumentationNodeKind.Type)
- node.addReferenceTo(typeNode, DocumentationReferenceKind.Detail)
+ val typeNode = DocumentationNode(descriptor, descriptor.getType().toString(), DocumentationContent.Empty, DocumentationNode.Kind.Type)
+ node.addReferenceTo(typeNode, DocumentationReference.Kind.Detail)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor?, data: DocumentationNode?): DocumentationNode? {
val doc = context.getDocumentation(descriptor!!)
- val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNodeKind.Constructor)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Member)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ val node = DocumentationNode(descriptor, descriptor.getName().asString(), doc, DocumentationNode.Kind.Constructor)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Member)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor?, data: DocumentationNode?): DocumentationNode? {
- val node = DocumentationNode(descriptor!!, descriptor.fqName.asString(), DocumentationContent.Empty, DocumentationNodeKind.Package)
- data!!.addReferenceTo(node, DocumentationReferenceKind.Member)
- node.addReferenceTo(data, DocumentationReferenceKind.Owner)
+ val node = DocumentationNode(descriptor!!, descriptor.fqName.asString(), DocumentationContent.Empty, DocumentationNode.Kind.Package)
+ data!!.addReferenceTo(node, DocumentationReference.Kind.Member)
+ node.addReferenceTo(data, DocumentationReference.Kind.Owner)
return node
}
}
diff --git a/src/Model/DocumentationReference.kt b/src/Model/DocumentationReference.kt
new file mode 100644
index 00000000..41cca8db
--- /dev/null
+++ b/src/Model/DocumentationReference.kt
@@ -0,0 +1,14 @@
+package org.jetbrains.dokka
+
+public data class DocumentationReference(val from: DocumentationNode, val to: DocumentationNode, val kind: DocumentationReference.Kind) {
+ public enum class Kind {
+ Owner
+ Member
+ Detail
+ Link
+ Override
+ }
+}
+
+
+
diff --git a/src/main.kt b/src/main.kt
index 975b2633..95cda7af 100644
--- a/src/main.kt
+++ b/src/main.kt
@@ -38,7 +38,7 @@ public fun main(args: Array<String>) {
val model = environment.processFiles { context, module, file ->
println("Processing: ${file.getName()}")
- context.createDocumentationModel(module, file)
+ context.createDocumentationModule(module, file)
}.reduce {(aggregate, item) -> aggregate.merge(item) }
ConsoleGenerator().generate(model)
diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt
index 29a64366..12c85c77 100644
--- a/test/src/TestAPI.kt
+++ b/test/src/TestAPI.kt
@@ -28,7 +28,7 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) ->
}
val result = environment.processFiles { context, module, file ->
- context.createDocumentationModel(module, file)
+ context.createDocumentationModule(module, file)
}.reduce {(aggregate, item) -> aggregate.merge(item) }
verifier(result)
Disposer.dispose(environment)
diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt
index 10eda003..47eeb2ce 100644
--- a/test/src/model/ClassTest.kt
+++ b/test/src/model/ClassTest.kt
@@ -8,7 +8,7 @@ public class ClassTest {
Test fun emptyClass() {
verifyModel("test/data/classes/emptyClass.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNodeKind.Class, kind)
+ assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -21,7 +21,7 @@ public class ClassTest {
Test fun gnClass() {
verifyModel("test/data/classes/emptyClass.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNodeKind.Class, kind)
+ assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -34,7 +34,7 @@ public class ClassTest {
Test fun emptyObject() {
verifyModel("test/data/classes/emptyObject.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNodeKind.Object, kind)
+ assertEquals(DocumentationNode.Kind.Object, kind)
assertEquals("Obj", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -47,7 +47,7 @@ public class ClassTest {
Test fun classWithConstructor() {
verifyModel("test/data/classes/classWithConstructor.kt") { model ->
with (model.members.single().members.single()) {
- assertEquals(DocumentationNodeKind.Class, kind)
+ assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -57,11 +57,11 @@ public class ClassTest {
with(members.elementAt(0)) {
assertEquals("<init>", name)
assertEquals(DocumentationContent.Empty, doc)
- assertEquals(DocumentationNodeKind.Constructor, kind)
+ assertEquals(DocumentationNode.Kind.Constructor, kind)
assertEquals(1, details.count())
with(details.elementAt(0)) {
assertEquals("name", name)
- assertEquals(DocumentationNodeKind.Parameter, kind)
+ assertEquals(DocumentationNode.Kind.Parameter, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(links.none())
@@ -77,7 +77,7 @@ public class ClassTest {
Test fun classWithFunction() {
verifyModel("test/data/classes/classWithFunction.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNodeKind.Class, kind)
+ assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -87,7 +87,7 @@ public class ClassTest {
with(members.elementAt(0)) {
assertEquals("<init>", name)
assertEquals(DocumentationContent.Empty, doc)
- assertEquals(DocumentationNodeKind.Constructor, kind)
+ assertEquals(DocumentationNode.Kind.Constructor, kind)
assertTrue(details.none())
assertTrue(links.none())
assertTrue(members.none())
@@ -95,7 +95,7 @@ public class ClassTest {
with(members.elementAt(1)) {
assertEquals("fn", name)
assertEquals(DocumentationContent.Empty, doc)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("Unit", details.single().name)
assertTrue(links.none())
assertTrue(members.none())
@@ -107,7 +107,7 @@ public class ClassTest {
Test fun classWithProperty() {
verifyModel("test/data/classes/classWithProperty.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(DocumentationNodeKind.Class, kind)
+ assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -117,7 +117,7 @@ public class ClassTest {
with(members.elementAt(0)) {
assertEquals("<init>", name)
assertEquals(DocumentationContent.Empty, doc)
- assertEquals(DocumentationNodeKind.Constructor, kind)
+ assertEquals(DocumentationNode.Kind.Constructor, kind)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
@@ -125,7 +125,7 @@ public class ClassTest {
with(members.elementAt(1)) {
assertEquals("name", name)
assertEquals(DocumentationContent.Empty, doc)
- assertEquals(DocumentationNodeKind.Property, kind)
+ assertEquals(DocumentationNode.Kind.Property, kind)
assertEquals("String", details.single().name)
assertTrue(members.none())
assertTrue(links.none())
diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt
index 5309ff89..e501d3c0 100644
--- a/test/src/model/FunctionTest.kt
+++ b/test/src/model/FunctionTest.kt
@@ -9,7 +9,7 @@ public class FunctionTest {
verifyModel("test/data/functions/function.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("fn", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("Function fn", doc.summary)
assertEquals("Unit", details.single().name)
assertTrue(members.none())
@@ -22,14 +22,14 @@ public class FunctionTest {
verifyModel("test/data/functions/functionWithReceiver.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("fn", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("Function with receiver", doc.summary)
assertEquals("Unit", details.elementAt(0).name)
assertEquals(2, details.count())
with(details.elementAt(1)) {
assertEquals("<this>", name)
- assertEquals(DocumentationNodeKind.Receiver, kind)
+ assertEquals(DocumentationNode.Kind.Receiver, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(members.none())
@@ -45,14 +45,14 @@ public class FunctionTest {
verifyModel("test/data/functions/genericFunction.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("generic function", doc.summary)
assertEquals(2, details.count())
assertEquals("Unit", details.elementAt(0).name)
with(details.elementAt(1)) {
assertEquals("T", name)
- assertEquals(DocumentationNodeKind.TypeParameter, kind)
+ assertEquals(DocumentationNode.Kind.TypeParameter, kind)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
assertTrue(members.none())
@@ -68,18 +68,18 @@ public class FunctionTest {
verifyModel("test/data/functions/genericFunctionWithConstraints.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("generic function", doc.summary)
assertEquals(3, details.count())
assertEquals("Unit", details.elementAt(0).name)
with(details.elementAt(1)) {
assertEquals("T", name)
- assertEquals(DocumentationNodeKind.TypeParameter, kind)
+ assertEquals(DocumentationNode.Kind.TypeParameter, kind)
assertEquals(DocumentationContent.Empty, doc)
with(details.single()) {
assertEquals("R", name)
- assertEquals(DocumentationNodeKind.UpperBound, kind)
+ assertEquals(DocumentationNode.Kind.UpperBound, kind)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
assertTrue(members.none())
@@ -90,7 +90,7 @@ public class FunctionTest {
}
with(details.elementAt(2)) {
assertEquals("R", name)
- assertEquals(DocumentationNodeKind.TypeParameter, kind)
+ assertEquals(DocumentationNode.Kind.TypeParameter, kind)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(members.none())
assertTrue(links.none())
@@ -106,7 +106,7 @@ public class FunctionTest {
verifyModel("test/data/functions/functionWithParams.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("function", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("""Multiline
Function
Documentation"""
@@ -116,7 +116,7 @@ Documentation"""
assertEquals("Unit", details.elementAt(0).name)
with(details.elementAt(1)) {
assertEquals("x", name)
- assertEquals(DocumentationNodeKind.Parameter, kind)
+ assertEquals(DocumentationNode.Kind.Parameter, kind)
assertEquals("parameter", doc.summary)
assertEquals("Int", details.single().name)
assertTrue(members.none())
diff --git a/test/src/model/PackageTest.kt b/test/src/model/PackageTest.kt
index 1cb9efa8..8fda37ea 100644
--- a/test/src/model/PackageTest.kt
+++ b/test/src/model/PackageTest.kt
@@ -8,7 +8,7 @@ public class PackageTest {
Test fun rootPackage() {
verifyModel("test/data/packages/rootPackage.kt") { model ->
with(model.members.single()) {
- assertEquals(DocumentationNodeKind.Package, kind)
+ assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -21,7 +21,7 @@ public class PackageTest {
Test fun simpleNamePackage() {
verifyModel("test/data/packages/simpleNamePackage.kt") { model ->
with(model.members.single()) {
- assertEquals(DocumentationNodeKind.Package, kind)
+ assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("simple", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -34,7 +34,7 @@ public class PackageTest {
Test fun dottedNamePackage() {
verifyModel("test/data/packages/dottedNamePackage.kt") { model ->
with(model.members.single()) {
- assertEquals(DocumentationNodeKind.Package, kind)
+ assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("dot.name", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -48,7 +48,7 @@ public class PackageTest {
verifyModel("test/data/packages/dottedNamePackage.kt", "test/data/packages/simpleNamePackage.kt") { model ->
assertEquals(2, model.members.count())
with(model.members.elementAt(0)) {
- assertEquals(DocumentationNodeKind.Package, kind)
+ assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("simple", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
@@ -56,7 +56,7 @@ public class PackageTest {
assertTrue(links.none())
}
with(model.members.elementAt(1)) {
- assertEquals(DocumentationNodeKind.Package, kind)
+ assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("dot.name", name)
assertEquals(DocumentationContent.Empty, doc)
assertTrue(details.none())
diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt
index f810e4ed..7768af90 100644
--- a/test/src/model/PropertyTest.kt
+++ b/test/src/model/PropertyTest.kt
@@ -9,7 +9,7 @@ public class PropertyTest {
verifyModel("test/data/properties/valueProperty.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNodeKind.Property, kind)
+ assertEquals(DocumentationNode.Kind.Property, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(members.none())
@@ -22,7 +22,7 @@ public class PropertyTest {
verifyModel("test/data/properties/variableProperty.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNodeKind.Property, kind)
+ assertEquals(DocumentationNode.Kind.Property, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(members.none())
@@ -35,13 +35,13 @@ public class PropertyTest {
verifyModel("test/data/properties/valuePropertyWithGetter.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNodeKind.Property, kind)
+ assertEquals(DocumentationNode.Kind.Property, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(links.none())
with(members.single()) {
assertEquals("<get-property>", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(links.none())
@@ -55,7 +55,7 @@ public class PropertyTest {
verifyModel("test/data/properties/variablePropertyWithAccessors.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
- assertEquals(DocumentationNodeKind.Property, kind)
+ assertEquals(DocumentationNode.Kind.Property, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(links.none())
@@ -63,7 +63,7 @@ public class PropertyTest {
assertEquals(2, members.count())
with(members.elementAt(0)) {
assertEquals("<get-property>", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(links.none())
@@ -71,13 +71,13 @@ public class PropertyTest {
}
with(members.elementAt(1)) {
assertEquals("<set-property>", name)
- assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals(2, details.count())
assertEquals("Unit", details.elementAt(0).name)
with(details.elementAt(1)) {
assertEquals("value", name)
- assertEquals(DocumentationNodeKind.Parameter, kind)
+ assertEquals(DocumentationNode.Kind.Parameter, kind)
assertEquals(DocumentationContent.Empty, doc)
assertEquals("String", details.single().name)
assertTrue(links.none())