mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
cached stages iteration 3.5
This commit is contained in:
@@ -47,10 +47,18 @@ abstract class AstNode extends AstNode_ {
|
||||
* Expr.getASubExpression(), Stmt.getASubStatement(), Stmt.getASubExpression() or
|
||||
* Scope.getAStmt() applied to the parent.
|
||||
*/
|
||||
AstNode getParentNode() { result.getAChildNode() = this }
|
||||
cached
|
||||
AstNode getParentNode() {
|
||||
Stages::SSA::ref() and
|
||||
result.getAChildNode() = this
|
||||
}
|
||||
|
||||
/** Whether this contains `inner` syntactically */
|
||||
predicate contains(AstNode inner) { this.getAChildNode+() = inner }
|
||||
cached
|
||||
predicate contains(AstNode inner) {
|
||||
Stages::SSA::ref() and
|
||||
this.getAChildNode+() = inner
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
private predicate containsInScope(AstNode inner, Scope scope) {
|
||||
@@ -114,6 +122,7 @@ class Comprehension extends Comprehension_, AstNode {
|
||||
result = Comprehension_.super.getLocation()
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
override AstNode getAChildNode() {
|
||||
Stages::SSA::ref() and
|
||||
result = this.getASubExpression()
|
||||
|
||||
@@ -75,6 +75,10 @@ module Stages {
|
||||
or
|
||||
exists(any(AstExtended::AstNode n).getAChildNode())
|
||||
or
|
||||
exists(any(AstExtended::AstNode n).getParentNode())
|
||||
or
|
||||
any(AstExtended::AstNode n).contains(_)
|
||||
or
|
||||
exists(any(PyFlow::BasicBlock b).getImmediateDominator())
|
||||
or
|
||||
any(PyFlow::BasicBlock b).strictlyDominates(_)
|
||||
|
||||
Reference in New Issue
Block a user