From 18399493263820cf6098603025802ddf862f1920 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Mon, 22 Dec 2014 09:50:17 +0200 Subject: Document some types in Dokka and fix to make them work. --- src/Analysis/CommentsAPI.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Analysis/CommentsAPI.kt') diff --git a/src/Analysis/CommentsAPI.kt b/src/Analysis/CommentsAPI.kt index 215f3e98..5f3f6283 100644 --- a/src/Analysis/CommentsAPI.kt +++ b/src/Analysis/CommentsAPI.kt @@ -5,6 +5,11 @@ import org.jetbrains.jet.lang.resolve.* import org.jetbrains.jet.kdoc.psi.api.* import org.jetbrains.jet.lang.psi.* +/** + * Retrieves PSI elements representing documentation from the [DeclarationDescriptor] + * + * $$receiver: [DeclarationDescriptor] to get documentation nodes from + */ fun DeclarationDescriptor.getDocumentationElements(): List { val psiElement = DescriptorToSourceUtils.descriptorToDeclaration(this) if (psiElement == null) @@ -17,6 +22,9 @@ fun DeclarationDescriptor.getDocumentationElements(): List { .reverse() // make reversed list } +/** + * Extracts text from KDoc, removes comment symbols and trims whitespace + */ fun KDoc?.extractText(): String { if (this == null) return "" @@ -27,7 +35,7 @@ fun KDoc?.extractText(): String { return lines.map { val comment = it.trim().dropWhile { it == '/' || it == '*' } (if (comment.endsWith("*/")) - comment.substring(0, comment.length - 2) + comment.substring(0, comment.length() - 2) else comment).trim() }.join("\n") -- cgit