Skip to content

Commit 0a9b864

Browse files
committed
Rust: Fix model generation test
1 parent f76647f commit 0a9b864

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
private import rust as R
2+
private import codeql.mad.test.InlineMadTest
3+
4+
private module InlineMadTestLang implements InlineMadTestLangSig {
5+
class Callable = R::Function;
6+
7+
string getComment(R::Function callable) {
8+
exists(R::Comment comment |
9+
result = comment.getCommentText() and
10+
comment.getLocation().getFile() = callable.getLocation().getFile() and
11+
// When a function is preceded by comments its start line is the line of
12+
// the first comment. Hence all relevant comments are found by including
13+
// comments from the start line and up to the line with the function
14+
// name.
15+
callable.getLocation().getStartLine() <= comment.getLocation().getStartLine() and
16+
comment.getLocation().getStartLine() <= callable.getName().getLocation().getStartLine()
17+
)
18+
}
19+
}
20+
21+
import InlineMadTestImpl<InlineMadTestLang>

0 commit comments

Comments
 (0)