mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Rust: add localDefinitions.ql
This commit is contained in:
23
rust/ql/lib/ide-contextual-queries/localDefinitions.ql
Normal file
23
rust/ql/lib/ide-contextual-queries/localDefinitions.ql
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user