-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPrintAST.ql
More file actions
27 lines (25 loc) · 782 Bytes
/
PrintAST.ql
File metadata and controls
27 lines (25 loc) · 782 Bytes
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
/**
* @name Print AST for javascript
* @description Outputs a representation of the Abstract Syntax Tree.
* @id javascript/tools/print-ast
* @kind graph
* @tags ast
*/
import javascript
import semmle.javascript.PrintAst
/**
* Temporarily tweak this class or make a copy to control
* which functions are printed.
*/
class Cfg extends PrintAstConfiguration {
/**
* TWEAK THIS PREDICATE AS NEEDED.
*/
override predicate shouldPrint(Locatable e, Location l) {
super.shouldPrint(e, l) and
// Only include source files with a `test` directory as the parent
// of its containing directory, which fits the expected structure
// of CodeQL unit tests in this project.
l.getFile().getParentContainer().getParentContainer().getBaseName() = "test"
}
}