We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 24334e4 + 0bfedc7 commit 9a02a22Copy full SHA for 9a02a22
ql/src/codeql_ql/ast/Ast.qll
@@ -79,10 +79,13 @@ class AstNode extends TAstNode {
79
* Gets the predicate that contains this AST node.
80
*/
81
pragma[noinline]
82
- Predicate getEnclosingPredicate() {
83
- not this instanceof Predicate and
84
- toQL(result) = toQL(this).getParent+()
85
- }
+ Predicate getEnclosingPredicate() { this = getANodeInPredicate(result) }
+}
+
+private AstNode getANodeInPredicate(Predicate pred) {
86
+ result = pred.getAChild(_)
87
+ or
88
+ result = getANodeInPredicate(pred).getAChild(_)
89
}
90
91
/** A toplevel QL program, i.e. a file. */
0 commit comments