QL: Make jump-to-def queries work for module references

This commit is contained in:
Tom Hvitved
2021-05-27 12:58:52 +02:00
parent b4a03fe3f0
commit aa23ec0714
2 changed files with 14 additions and 12 deletions

View File

@@ -7,14 +7,15 @@
* @tags ide-contextual-queries/local-definitions
*/
import ql
import codeql_ql.ast.internal.Module
import codeql.IDEContextual
import codeql_ql.ast.internal.TreeSitter::Generated
external string selectedSourceFile();
from AstNode e, Variable def, string kind
from ModuleRef ref, FileOrModule target, string kind
where
none() and // e = def.getAnAccess() and // TODO: Get binding to work.
kind = "local variable" and
e.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
select e, def, kind
target = ref.getResolvedModule() and
kind = "module" and
ref.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
select ref, target, kind

View File

@@ -7,14 +7,15 @@
* @tags ide-contextual-queries/local-references
*/
import ql
import codeql_ql.ast.internal.Module
import codeql.IDEContextual
import codeql_ql.ast.internal.TreeSitter::Generated
external string selectedSourceFile();
from AstNode e, Variable def, string kind
from ModuleRef ref, FileOrModule target, string kind
where
none() and // e = def.getAnAccess() and // TODO: Get binding to work.
kind = "local variable" and
def.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
select e, def, kind
target = ref.getResolvedModule() and
kind = "module" and
ref.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
select ref, target, kind