mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Add support for InlineExpectationsTest to Kotlin
This commit is contained in:
@@ -4,9 +4,19 @@ import java
|
||||
* A class representing line comments in Java, which is simply Javadoc restricted
|
||||
* to EOL comments, with an extra accessor used by the InlineExpectations core code
|
||||
*/
|
||||
class ExpectationComment extends Javadoc {
|
||||
ExpectationComment() { isEolComment(this) }
|
||||
|
||||
abstract class ExpectationComment extends Top {
|
||||
/** Gets the contents of the given comment, _without_ the preceding comment marker (`//`). */
|
||||
string getContents() { result = this.getChild(0).toString() }
|
||||
abstract string getContents();
|
||||
}
|
||||
|
||||
private class JavadocExpectationComment extends Javadoc, ExpectationComment {
|
||||
JavadocExpectationComment() { isEolComment(this) }
|
||||
|
||||
override string getContents() { result = this.getChild(0).toString() }
|
||||
}
|
||||
|
||||
private class KtExpectationComment extends KtComment, ExpectationComment {
|
||||
override string getContents() {
|
||||
result = this.getText().regexpCapture("(?://|/\\*)(.*)(?:\\*/)?", 1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user