From 60df048fb3c9415fa807b2ccd71b4bd50b89d147 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Wed, 30 Sep 2026 10:41:31 +0200 Subject: [PATCH] Unified: Speedup Print AST --- unified/ql/lib/codeql/unified/printAst.qll | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/unified/ql/lib/codeql/unified/printAst.qll b/unified/ql/lib/codeql/unified/printAst.qll index 93ff11f5c8b1..06dc4de34ca1 100644 --- a/unified/ql/lib/codeql/unified/printAst.qll +++ b/unified/ql/lib/codeql/unified/printAst.qll @@ -49,9 +49,11 @@ private string reorderName(string name) { } class PrintAstNode extends AstNode { + PrintAstNode() { shouldPrintNode(this) } + final int getOrder() { this = - rank[result](AstNode parent, AstNode child, string name, int i | + rank[result](PrintAstNode parent, PrintAstNode child, string name, int i | child = PrintAst::getChild(parent, name, i) | child order by reorderName(name), i @@ -70,10 +72,7 @@ class PrintAstNode extends AstNode { * Holds if `node` belongs to the output tree, and its property `key` has the * given `value`. */ -query predicate nodes(PrintAstNode node, string key, string value) { - shouldPrintNode(node) and - value = node.getProperty(key) -} +query predicate nodes(PrintAstNode node, string key, string value) { value = node.getProperty(key) } /** * Holds if `target` is a child of `source` in the AST, and property `key` of