Skip to content

Commit

Permalink
Merge pull request #17804 from github/aibaars/local-defs-1
Browse files Browse the repository at this point in the history
Rust: add ide-contextual-queries/localDefinitions.ql
  • Loading branch information
aibaars authored Oct 21, 2024
2 parents e9adbf2 + 4a5a48a commit 490f814
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rust/ql/lib/ide-contextual-queries/localDefinitions.ql
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

0 comments on commit 490f814

Please sign in to comment.