Skip to content

Commit 490f814

Browse files
authored
Merge pull request github#17804 from github/aibaars/local-defs-1
Rust: add ide-contextual-queries/localDefinitions.ql
2 parents e9adbf2 + 4a5a48a commit 490f814

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @name Jump-to-definition links
3+
* @description Generates use-definition pairs that provide the data
4+
* for jump-to-definition in the code viewer.
5+
* @kind definitions
6+
* @id rus/ide-jump-to-definition
7+
* @tags ide-contextual-queries/local-definitions
8+
*/
9+
10+
import codeql.IDEContextual
11+
import codeql.rust.elements.Variable
12+
import codeql.rust.elements.Locatable
13+
14+
external string selectedSourceFile();
15+
16+
predicate localVariable(Locatable e, Variable def) { e = def.getAnAccess() }
17+
18+
from Locatable e, Variable def, string kind
19+
where
20+
e.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile()) and
21+
localVariable(e, def) and
22+
kind = "local variable"
23+
select e, def, kind

0 commit comments

Comments
 (0)