mirror of
https://github.com/github/codeql.git
synced 2026-02-07 18:51:06 +01:00
add getEnclosingPredicate utility predicate
This commit is contained in:
committed by
GitHub
parent
fb50ba407d
commit
5dcc161f2d
@@ -56,6 +56,15 @@ class AstNode extends TAstNode {
|
||||
* Gets the primary QL class for the ast node.
|
||||
*/
|
||||
string getAPrimaryQlClass() { result = "???" }
|
||||
|
||||
/**
|
||||
* Gets the predicate that contains this AST node.
|
||||
*/
|
||||
pragma[noinline]
|
||||
Predicate getEnclosingPredicate() {
|
||||
not this instanceof Predicate and
|
||||
toGenerated(result) = toGenerated(this).getParent+()
|
||||
}
|
||||
}
|
||||
|
||||
/** A toplevel QL program, i.e. a file. */
|
||||
|
||||
Reference in New Issue
Block a user