aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Languages/JavaLanguageService.kt4
-rw-r--r--src/Languages/KotlinLanguageService.kt4
-rw-r--r--src/Model/DocumentationContent.kt5
-rw-r--r--src/Model/DocumentationNode.kt2
4 files changed, 10 insertions, 5 deletions
diff --git a/src/Languages/JavaLanguageService.kt b/src/Languages/JavaLanguageService.kt
index 8cc185f4..f5976ea9 100644
--- a/src/Languages/JavaLanguageService.kt
+++ b/src/Languages/JavaLanguageService.kt
@@ -116,7 +116,7 @@ class JavaLanguageService : LanguageService {
else -> throw IllegalArgumentException("Node $node is not a function-like object")
}
- val receiver = node.details(Kind.Receiver).firstOrNull() // TODO: replace with singleOrNull when fixed
+ val receiver = node.details(Kind.Receiver).singleOrNull()
append("(")
if (receiver != null)
append((listOf(receiver) + node.details(Kind.Parameter)).map { renderParameter(it) }.join())
@@ -134,7 +134,7 @@ class JavaLanguageService : LanguageService {
else -> throw IllegalArgumentException("Node $node is not a property")
}
append(renderTypeParametersForNode(node))
- val receiver = node.details(Kind.Receiver).firstOrNull() // TODO: replace with singleOrNull when fixed
+ val receiver = node.details(Kind.Receiver).singleOrNull()
if (receiver != null) {
append(renderType(receiver.detail(Kind.Type)))
append(".")
diff --git a/src/Languages/KotlinLanguageService.kt b/src/Languages/KotlinLanguageService.kt
index 0b6ae11d..7307cffb 100644
--- a/src/Languages/KotlinLanguageService.kt
+++ b/src/Languages/KotlinLanguageService.kt
@@ -126,7 +126,7 @@ class KotlinLanguageService : LanguageService {
else -> throw IllegalArgumentException("Node $node is not a function-like object")
}
append(renderTypeParametersForNode(node))
- val receiver = node.details(Kind.Receiver).firstOrNull() // TODO: replace with singleOrNull when fixed
+ val receiver = node.details(Kind.Receiver).singleOrNull()
if (receiver != null) {
append(renderType(receiver.detail(Kind.Type)))
append(".")
@@ -153,7 +153,7 @@ class KotlinLanguageService : LanguageService {
else -> throw IllegalArgumentException("Node $node is not a property")
}
append(renderTypeParametersForNode(node))
- val receiver = node.details(Kind.Receiver).firstOrNull() // TODO: replace with singleOrNull when fixed
+ val receiver = node.details(Kind.Receiver).singleOrNull()
if (receiver != null) {
append(renderType(receiver.detail(Kind.Type)))
append(".")
diff --git a/src/Model/DocumentationContent.kt b/src/Model/DocumentationContent.kt
index e8f32a33..cebb429b 100644
--- a/src/Model/DocumentationContent.kt
+++ b/src/Model/DocumentationContent.kt
@@ -9,6 +9,7 @@ public class DocumentationContentSection(public val label: String, public val te
}
}
+// TODO: refactor sections to map
public class DocumentationContent(public val summary: RichString,
public val description: RichString,
public val sections: List<DocumentationContentSection>) {
@@ -54,6 +55,10 @@ fun BindingContext.getDocumentation(descriptor: DeclarationDescriptor): Document
}
fun List<DocumentationContentSection>.extractSummaryAndDescription() : Pair<RichString, RichString> {
+ // TODO: rework to unify
+ // if no $summary and $description is present, parse unnamed section and create specific sections
+ // otherwise, create empty sections for missing
+
val summary = firstOrNull { it.label == "\$summary" }
if (summary != null) {
val description = firstOrNull { it.label == "\$description" }
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index 5469774d..c96c383d 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -12,7 +12,7 @@ public open class DocumentationNode(val descriptor: DeclarationDescriptor,
private val references = LinkedHashSet<DocumentationReference>()
public val owner: DocumentationNode?
- get() = references(DocumentationReference.Kind.Owner).firstOrNull()?.to // TODO: should be singleOrNull, but bugz!
+ get() = references(DocumentationReference.Kind.Owner).singleOrNull()?.to
public val details: List<DocumentationNode>
get() = references(DocumentationReference.Kind.Detail).map { it.to }
public val members: List<DocumentationNode>