mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
22 lines
855 B
Plaintext
22 lines
855 B
Plaintext
private import rust as R
|
|
private import codeql.mad.test.InlineMadTest
|
|
|
|
private module InlineMadTestLang implements InlineMadTestLangSig {
|
|
class Callable = R::Function;
|
|
|
|
string getComment(R::Function callable) {
|
|
exists(R::Comment comment |
|
|
result = comment.getCommentText() and
|
|
comment.getLocation().getFile() = callable.getLocation().getFile() and
|
|
// When a function is preceded by comments its start line is the line of
|
|
// the first comment. Hence all relevant comments are found by including
|
|
// comments from the start line and up to the line with the function
|
|
// name.
|
|
callable.getLocation().getStartLine() <= comment.getLocation().getStartLine() and
|
|
comment.getLocation().getStartLine() <= callable.getName().getLocation().getStartLine()
|
|
)
|
|
}
|
|
}
|
|
|
|
import InlineMadTestImpl<InlineMadTestLang>
|