Skip to content

Commit e80686c

Browse files
authored
Merge pull request #22615 from aschackmull/unified/cfg-tweaks
Unified: CFG tweaks
2 parents bd75795 + 0e4a06b commit e80686c

4 files changed

Lines changed: 132 additions & 123 deletions

File tree

unified/ql/lib/codeql/unified/internal/ControlFlowGraph.qll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ private module Ast implements AstSig<Location> {
3030
e instanceof Modifier
3131
or
3232
e instanceof Identifier and not e instanceof IdentifierExpr
33+
or
34+
e instanceof Operator
3335
}
3436

3537
AstNode getChild(AstNode n, int index) {
@@ -38,6 +40,8 @@ private module Ast implements AstSig<Location> {
3840
not n instanceof Callable and
3941
not skipControlFlow(n) and
4042
not skipControlFlow(result)
43+
or
44+
n.(FunctionExpr).getCaptureDeclaration(index) = result
4145
}
4246

4347
Callable getEnclosingCallable(AstNode node) { result = node.getEnclosingCallable() }
@@ -71,14 +75,12 @@ private module Ast implements AstSig<Location> {
7175
Expr getExpr() { none() }
7276
}
7377

74-
class IfStmt extends Stmt {
75-
IfStmt() { none() }
76-
77-
Expr getCondition() { none() }
78+
class IfStmt extends Stmt instanceof U::GuardIfStmt {
79+
Expr getCondition() { result = super.getCondition() }
7880

7981
Stmt getThen() { none() }
8082

81-
Stmt getElse() { none() }
83+
Stmt getElse() { result = super.getElse() }
8284
}
8385

8486
abstract class LoopStmt extends Stmt {

0 commit comments

Comments
 (0)