diff options
Diffstat (limited to 'src/Kotlin')
-rw-r--r-- | src/Kotlin/ContentBuilder.kt | 4 | ||||
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt index 42a2d994..abe24917 100644 --- a/src/Kotlin/ContentBuilder.kt +++ b/src/Kotlin/ContentBuilder.kt @@ -126,7 +126,9 @@ public fun DocumentationBuilder.buildInlineContentTo(tree: MarkdownNode, target: } } -fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functionName: String): ContentNode { +fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functionName: String?): ContentNode { + if (functionName == null) + return ContentBlockCode().let() { it.append(ContentText("Missing function name in @sample")); it } val scope = getResolutionScope(session, descriptor) val rootPackage = session.getModuleDescriptor().getPackage(FqName.ROOT)!! val rootScope = rootPackage.getMemberScope() diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index ca19c364..1680b407 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -52,7 +52,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati val tags = kdoc.getTags() tags.forEach { if (it.getName() == "sample") { - content.append(functionBody(descriptor, it.getContent())) + content.append(functionBody(descriptor, it.getSubjectName())) } else { val section = content.addSection(displayName(it.getName()), it.getSubjectName()) val sectionContent = it.getContent() |