mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Accept only EOL comments as Kotlin expectation comments
This commit is contained in:
@@ -153,6 +153,15 @@ class KtComment extends Top, @ktcomment {
|
||||
/** Gets the full text of this comment. */
|
||||
string getText() { ktComments(this, _, result) }
|
||||
|
||||
/** Holds if this comment is an EOL comment. */
|
||||
predicate isEolComment() { ktComments(this, 1, _) }
|
||||
|
||||
/** Holds if this comment is a block comment. */
|
||||
predicate isBlockComment() { ktComments(this, 2, _) }
|
||||
|
||||
/** Holds if this comment is a KDoc comment. */
|
||||
predicate isDocComment() { ktComments(this, 3, _) }
|
||||
|
||||
/** Gets the sections of this comment. */
|
||||
KtCommentSection getSections() { ktCommentSections(result, this, _) }
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ private class JavadocExpectationComment extends Javadoc, ExpectationComment {
|
||||
}
|
||||
|
||||
private class KtExpectationComment extends KtComment, ExpectationComment {
|
||||
override string getContents() {
|
||||
result = this.getText().regexpCapture("(?://|/\\*)(.*)(?:\\*/)?", 1)
|
||||
}
|
||||
KtExpectationComment() { this.isEolComment() }
|
||||
|
||||
override string getContents() { result = this.getText().suffix(2).trim() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user