Add QL classes and tests for comments

This commit is contained in:
Tamas Vajk
2021-09-27 15:24:11 +02:00
committed by Ian Lynagh
parent 7d479943db
commit ab77ed085f
4 changed files with 103 additions and 0 deletions

View File

@@ -147,3 +147,37 @@ class JavadocText extends JavadocElement, @javadocText {
override string getAPrimaryQlClass() { result = "JavadocText" }
}
/** A Kotlin comment. */
class KtComment extends Top, @ktcomment {
/** Gets the full text of this comment. */
string getText() { ktComments(this, _, result) }
/** Gets the sections of this comment. */
KtCommentSection getSections() { ktCommentSections(result, this, _) }
/** Gets the owner of this comment, if any. */
Top getOwner() { ktCommentOwners(this, result) }
override string toString() { result = this.getText() }
override string getAPrimaryQlClass() { result = "KtComment" }
}
/** A Kotlin comment. */
class KtCommentSection extends @ktcommentsection {
/** Gets the content text of this section. */
string getContent() { ktCommentSections(this, _, result) }
/** Gets the parent comment. */
KtComment getParent() { ktCommentSections(this, result, _) }
/** Gets the section name if any. */
string getName() { ktCommentSectionNames(this, result) }
/** Gets the section subject name if any. */
string getSubjectName() { ktCommentSectionSubjectNames(this, result) }
/** Gets the string representation of this section. */
string toString() { result = this.getContent() }
}