aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Generation/JavaSignatureGenerator.kt4
-rw-r--r--src/Generation/KotlinSignatureGenerator.kt4
-rw-r--r--src/Model/Diagnostics.kt4
-rw-r--r--src/Model/DocumentationNode.kt2
-rw-r--r--src/Model/DocumentationNodeBuilder.kt3
-rw-r--r--test/playground.kt6
6 files changed, 21 insertions, 2 deletions
diff --git a/src/Generation/JavaSignatureGenerator.kt b/src/Generation/JavaSignatureGenerator.kt
index 6ba9ac88..774eaeb4 100644
--- a/src/Generation/JavaSignatureGenerator.kt
+++ b/src/Generation/JavaSignatureGenerator.kt
@@ -8,6 +8,8 @@ class JavaSignatureGenerator : SignatureGenerator {
Kind.Package -> renderPackage(node)
Kind.Class,
Kind.Interface,
+ Kind.Enum,
+ Kind.EnumItem,
Kind.Object -> renderClass(node)
Kind.TypeParameter -> renderTypeParameter(node)
@@ -83,6 +85,8 @@ class JavaSignatureGenerator : SignatureGenerator {
when (node.kind) {
Kind.Class -> append("class ")
Kind.Interface -> append("interface ")
+ Kind.Enum -> append("enum ")
+ Kind.EnumItem -> append("enum value ")
Kind.Object -> append("class ")
else -> throw IllegalArgumentException("Node $node is not a class-like object")
}
diff --git a/src/Generation/KotlinSignatureGenerator.kt b/src/Generation/KotlinSignatureGenerator.kt
index 481e5133..50704f1c 100644
--- a/src/Generation/KotlinSignatureGenerator.kt
+++ b/src/Generation/KotlinSignatureGenerator.kt
@@ -8,6 +8,8 @@ class KotlinSignatureGenerator : SignatureGenerator {
Kind.Package -> renderPackage(node)
Kind.Class,
Kind.Interface,
+ Kind.Enum,
+ Kind.EnumItem,
Kind.Object -> renderClass(node)
Kind.TypeParameter -> renderTypeParameter(node)
@@ -75,6 +77,8 @@ class KotlinSignatureGenerator : SignatureGenerator {
when (node.kind) {
Kind.Class -> append("class ")
Kind.Interface -> append("trait ")
+ Kind.Enum -> append("enum class ")
+ Kind.EnumItem -> append("enum val ")
Kind.Object -> append("object ")
else -> throw IllegalArgumentException("Node $node is not a class-like object")
}
diff --git a/src/Model/Diagnostics.kt b/src/Model/Diagnostics.kt
index 899ff7de..a464107f 100644
--- a/src/Model/Diagnostics.kt
+++ b/src/Model/Diagnostics.kt
@@ -12,8 +12,8 @@ fun BindingContext.checkResolveChildren(node : DocumentationNode) {
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
- DocumentationNode.Kind.Receiver -> (parentScope.getContainingDeclaration() as CallableDescriptor).getReceiverParameter()
+ 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()
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index ccfb9b7d..8132c419 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -50,6 +50,8 @@ public open class DocumentationNode(val descriptor: DeclarationDescriptor,
Package
Class
Interface
+ Enum
+ EnumItem
Object
Constructor
diff --git a/src/Model/DocumentationNodeBuilder.kt b/src/Model/DocumentationNodeBuilder.kt
index 1f553f33..f974ab11 100644
--- a/src/Model/DocumentationNodeBuilder.kt
+++ b/src/Model/DocumentationNodeBuilder.kt
@@ -61,7 +61,10 @@ class DocumentationNodeBuilder(val context: BindingContext) : DeclarationDescrip
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)
diff --git a/test/playground.kt b/test/playground.kt
index 54cdc958..9eb7d879 100644
--- a/test/playground.kt
+++ b/test/playground.kt
@@ -55,6 +55,12 @@ object Object {
}
+enum class Color(r: Int, g: Int, b: Int) {
+ Red : Color(100,0,0)
+ Green : Color(0,100,0)
+ Blue : Color(0,0,100)
+}
+
class OuterClass {
/**