aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Model/DocumentationBuilder.kt6
-rw-r--r--src/Model/DocumentationModel.kt1
-rw-r--r--test/data/functions/functionWithReceiver.kt5
-rw-r--r--test/src/model/FunctionTest.kt20
4 files changed, 32 insertions, 0 deletions
diff --git a/src/Model/DocumentationBuilder.kt b/src/Model/DocumentationBuilder.kt
index 73f83ff9..464a5ab2 100644
--- a/src/Model/DocumentationBuilder.kt
+++ b/src/Model/DocumentationBuilder.kt
@@ -26,6 +26,12 @@ class DocumentationBuilderVisitor(val context: BindingContext) : DeclarationDesc
return node
}
+ override fun visitReceiverParameterDescriptor(descriptor: ReceiverParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
+ val node = DocumentationNode(descriptor!!.getName().asString(), "", DocumentationNodeKind.Receiver)
+ data?.addReferenceTo(node, DocumentationReferenceKind.Detail)
+ return node
+ }
+
override fun visitValueParameterDescriptor(descriptor: ValueParameterDescriptor?, data: DocumentationNode?): DocumentationNode? {
val doc = context.getDocumentation(descriptor!!)
val node = DocumentationNode(descriptor.getName().asString(), doc, DocumentationNodeKind.Parameter)
diff --git a/src/Model/DocumentationModel.kt b/src/Model/DocumentationModel.kt
index 7f40acb2..61c3b28a 100644
--- a/src/Model/DocumentationModel.kt
+++ b/src/Model/DocumentationModel.kt
@@ -13,6 +13,7 @@ public enum class DocumentationNodeKind {
Function
Property
Parameter
+ Receiver
TypeParameter
UpperBound
LowerBound
diff --git a/test/data/functions/functionWithReceiver.kt b/test/data/functions/functionWithReceiver.kt
new file mode 100644
index 00000000..663c3e56
--- /dev/null
+++ b/test/data/functions/functionWithReceiver.kt
@@ -0,0 +1,5 @@
+/**
+ * Function with receiver
+ */
+fun String.fn() {
+} \ No newline at end of file
diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt
index 20ae390c..217e97f4 100644
--- a/test/src/model/FunctionTest.kt
+++ b/test/src/model/FunctionTest.kt
@@ -18,6 +18,26 @@ public class FunctionTest {
}
}
+ Test fun functionWithReceiver() {
+ verifyModel("test/data/functions/functionWithReceiver.kt") { model ->
+ with(model.nodes.single().members.single()) {
+ assertEquals("fn", name)
+ assertEquals(DocumentationNodeKind.Function, kind)
+ assertEquals("Function with receiver", doc)
+ with(details.single()) {
+ assertEquals("<this>", name)
+ assertEquals(DocumentationNodeKind.Receiver, kind)
+ assertEquals("", doc)
+ assertTrue(details.none())
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ }
+ }
+
Test fun genericFunction() {
verifyModel("test/data/functions/genericFunction.kt") { model ->
with(model.nodes.single().members.single()) {