fix performance of the transitive step query

This commit is contained in:
Erik Krogh Kristensen
2021-10-15 18:47:54 +02:00
parent df3d5aefc7
commit 62355f3f0e

View File

@@ -79,10 +79,13 @@ class AstNode extends TAstNode {
* Gets the predicate that contains this AST node.
*/
pragma[noinline]
Predicate getEnclosingPredicate() {
not this instanceof Predicate and
toQL(result) = toQL(this).getParent+()
}
Predicate getEnclosingPredicate() { this = getANodeInPredicate(result) }
}
private AstNode getANodeInPredicate(Predicate pred) {
result = pred.getAChild(_)
or
result = getANodeInPredicate(pred).getAChild(_)
}
/** A toplevel QL program, i.e. a file. */