Skip to content

Commit 9a02a22

Browse files
authored
QL: Merge pull request #124 from github/erik-krogh/fix-step-performance
fix performance of the transitive step query
2 parents 24334e4 + 0bfedc7 commit 9a02a22

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ql/src/codeql_ql/ast/Ast.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,13 @@ class AstNode extends TAstNode {
7979
* Gets the predicate that contains this AST node.
8080
*/
8181
pragma[noinline]
82-
Predicate getEnclosingPredicate() {
83-
not this instanceof Predicate and
84-
toQL(result) = toQL(this).getParent+()
85-
}
82+
Predicate getEnclosingPredicate() { this = getANodeInPredicate(result) }
83+
}
84+
85+
private AstNode getANodeInPredicate(Predicate pred) {
86+
result = pred.getAChild(_)
87+
or
88+
result = getANodeInPredicate(pred).getAChild(_)
8689
}
8790

8891
/** A toplevel QL program, i.e. a file. */

0 commit comments

Comments
 (0)