-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathprintDfg.ql
More file actions
48 lines (36 loc) · 1.44 KB
/
printDfg.ql
File metadata and controls
48 lines (36 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @name Print DFG
* @description Produces a representation of a file's Data Flow Graph.
* This query is used by the VS Code extension.
* @id js/print-dfg
* @kind graph
* @tags ide-contextual-queries/print-dfg
*/
private import javascript
private import semmle.javascript.dataflow.internal.sharedlib.DataFlowArg
private import codeql.dataflow.PrintDfg
import MakePrintDfg<Location, JSDataFlow, JSTaintFlow>
external string selectedSourceFile();
private predicate selectedSourceFileAlias = selectedSourceFile/0;
external int selectedSourceLine();
private predicate selectedSourceLineAlias = selectedSourceLine/0;
external int selectedSourceColumn();
private predicate selectedSourceColumnAlias = selectedSourceColumn/0;
module ViewGraphInput implements ViewGraphQueryInputSig<File> {
predicate selectedSourceFile = selectedSourceFileAlias/0;
predicate selectedSourceLine = selectedSourceLineAlias/0;
predicate selectedSourceColumn = selectedSourceColumnAlias/0;
/**
* Holds if `callable` spans column `startColumn` of line `startLine` to
* column `endColumn` of line `endLine` in `file`.
*/
predicate callableSpan(
JSDataFlow::DataFlowCallable callable, File file, int startLine, int startColumn, int endLine,
int endColumn
) {
callable
.getLocation()
.hasLocationInfo(file.getAbsolutePath(), startLine, startColumn, endLine, endColumn)
}
}
import ViewGraphQuery<File, ViewGraphInput>