diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-20 22:38:11 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-20 22:38:11 +0300 |
commit | 0298076ba9cf22b70b6c85846ad555e201ee95ee (patch) | |
tree | c61dff4bfcb266d3da25fed2aedcf53e203acf46 | |
parent | bd92d65eba154d756c47c0ea2f304db04ac0ffae (diff) | |
download | dokka-0298076ba9cf22b70b6c85846ad555e201ee95ee.tar.gz dokka-0298076ba9cf22b70b6c85846ad555e201ee95ee.tar.bz2 dokka-0298076ba9cf22b70b6c85846ad555e201ee95ee.zip |
Support receiver reference
-rw-r--r-- | core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 2 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 4 | ||||
-rw-r--r-- | core/testdata/format/receiverReference.kt | 6 | ||||
-rw-r--r-- | core/testdata/format/receiverReference.md | 6 |
4 files changed, 18 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index fddf0814..04993ad4 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -746,6 +746,7 @@ class DocumentationBuilder val node = DocumentationNode(name.asString(), Content.Empty, NodeKind.Receiver) node.appendType(type) + register(this, node) return node } @@ -915,6 +916,7 @@ fun DeclarationDescriptor.signature(): String = when (this) { is FunctionDescriptor -> containingDeclaration.signature() + "$" + name + parameterSignature() is ValueParameterDescriptor -> containingDeclaration.signature() + "/" + name is TypeParameterDescriptor -> containingDeclaration.signature() + "*" + name + is ReceiverParameterDescriptor -> containingDeclaration.signature() + "*" + name else -> throw UnsupportedOperationException("Don't know how to calculate signature for $this") } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index fbebfbfd..97a8ad4b 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -380,6 +380,10 @@ class MarkdownFormatTest { verifyMarkdownNode("indentedCodeBlock") } + @Test fun receiverReference() { + verifyMarkdownNode("receiverReference") + } + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") val options = DocumentationOptions("", "html", generateIndexPages = false, noStdlibLink = true) diff --git a/core/testdata/format/receiverReference.kt b/core/testdata/format/receiverReference.kt new file mode 100644 index 00000000..3e6e2056 --- /dev/null +++ b/core/testdata/format/receiverReference.kt @@ -0,0 +1,6 @@ +/** + * Prints [this] + */ +fun String.some() { + println(this) +}
\ No newline at end of file diff --git a/core/testdata/format/receiverReference.md b/core/testdata/format/receiverReference.md new file mode 100644 index 00000000..1584b2b1 --- /dev/null +++ b/core/testdata/format/receiverReference.md @@ -0,0 +1,6 @@ +[test](test/index) / [kotlin.String](test/kotlin.-string/index) + +### Extensions for kotlin.String + +| [some](test/kotlin.-string/some) | `fun String.some(): Unit`<br>Prints [this](test/kotlin.-string/some/-this-) | + |