mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
inline Location into the shared implementation of InlineExpectationsTest
This commit is contained in:
@@ -5,31 +5,27 @@
|
||||
|
||||
private import ql as QL
|
||||
private import codeql.util.test.InlineExpectationsTest
|
||||
private import codeql_ql.ast.internal.TreeSitter as TS
|
||||
|
||||
private module Impl implements InlineExpectationsTestSig {
|
||||
private import codeql_ql.ast.internal.TreeSitter as TS
|
||||
private newtype TExpectationComment = MkExpectationComment(TS::QL::LineComment comment)
|
||||
|
||||
private newtype TExpectationComment = MkExpectationComment(TS::QL::LineComment comment)
|
||||
/**
|
||||
* Represents a line comment.
|
||||
*/
|
||||
private class ExpectationComment extends TExpectationComment {
|
||||
TS::QL::LineComment comment;
|
||||
|
||||
/**
|
||||
* Represents a line comment.
|
||||
*/
|
||||
class ExpectationComment extends TExpectationComment {
|
||||
TS::QL::LineComment comment;
|
||||
ExpectationComment() { this = MkExpectationComment(comment) }
|
||||
|
||||
ExpectationComment() { this = MkExpectationComment(comment) }
|
||||
/** Returns the contents of the given comment, _without_ the preceding comment marker (`//`). */
|
||||
string getContents() { result = comment.getValue().suffix(2) }
|
||||
|
||||
/** Returns the contents of the given comment, _without_ the preceding comment marker (`//`). */
|
||||
string getContents() { result = comment.getValue().suffix(2) }
|
||||
/** Gets a textual representation of this element. */
|
||||
string toString() { result = comment.toString() }
|
||||
|
||||
/** Gets a textual representation of this element. */
|
||||
string toString() { result = comment.toString() }
|
||||
|
||||
/** Gets the location of this comment. */
|
||||
Location getLocation() { result = comment.getLocation() }
|
||||
predicate hasLocationInfo(string file, int line, int column, int endLine, int endColumn) {
|
||||
comment.getLocation().hasLocationInfo(file, line, column, endLine, endColumn)
|
||||
}
|
||||
|
||||
class Location = QL::Location;
|
||||
}
|
||||
|
||||
import Make<Impl>
|
||||
import Make<ExpectationComment>
|
||||
|
||||
Reference in New Issue
Block a user