-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17804 from github/aibaars/local-defs-1
Rust: add ide-contextual-queries/localDefinitions.ql
- Loading branch information
Showing
3 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @name Jump-to-definition links | ||
* @description Generates use-definition pairs that provide the data | ||
* for jump-to-definition in the code viewer. | ||
* @kind definitions | ||
* @id rus/ide-jump-to-definition | ||
* @tags ide-contextual-queries/local-definitions | ||
*/ | ||
|
||
import codeql.IDEContextual | ||
import codeql.rust.elements.Variable | ||
import codeql.rust.elements.Locatable | ||
|
||
external string selectedSourceFile(); | ||
|
||
predicate localVariable(Locatable e, Variable def) { e = def.getAnAccess() } | ||
|
||
from Locatable e, Variable def, string kind | ||
where | ||
e.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile()) and | ||
localVariable(e, def) and | ||
kind = "local variable" | ||
select e, def, kind |
File renamed without changes.