Skip to content

Commit a7209e2

Browse files
authored
Merge pull request #22706 from hvitved/unified/print-ast-speedup
Unified: Speedup Print AST
2 parents a47a4a8 + 60df048 commit a7209e2

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎unified/ql/lib/codeql/unified/printAst.qll‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ private string reorderName(string name) {
4949
}
5050

5151
class PrintAstNode extends AstNode {
52+
PrintAstNode() { shouldPrintNode(this) }
53+
5254
final int getOrder() {
5355
this =
54-
rank[result](AstNode parent, AstNode child, string name, int i |
56+
rank[result](PrintAstNode parent, PrintAstNode child, string name, int i |
5557
child = PrintAst::getChild(parent, name, i)
5658
|
5759
child order by reorderName(name), i
@@ -70,10 +72,7 @@ class PrintAstNode extends AstNode {
7072
* Holds if `node` belongs to the output tree, and its property `key` has the
7173
* given `value`.
7274
*/
73-
query predicate nodes(PrintAstNode node, string key, string value) {
74-
shouldPrintNode(node) and
75-
value = node.getProperty(key)
76-
}
75+
query predicate nodes(PrintAstNode node, string key, string value) { value = node.getProperty(key) }
7776

7877
/**
7978
* Holds if `target` is a child of `source` in the AST, and property `key` of

0 commit comments

Comments
 (0)