Skip to content

Commit 0e4da95

Browse files
committed
CFG: Handle parameter cfg explicitly.
1 parent 155341e commit 0e4da95

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎shared/controlflow/codeql/controlflow/ControlFlowGraph.qll‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,11 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
689689
not postOrInOrder(n) and
690690
not additionalNode(n, _, _) and
691691
not inConditionalContext(n, _)
692+
or
693+
// A parameter pattern represented by the parameter itself should not be
694+
// considered to have child nodes.
695+
n.(Parameter).getPattern() = n and
696+
not inConditionalContext(n, _)
692697
}
693698

694699
private string catchClauseEmptyBodyTag() { result = "[CatchClauseEmptyBody]" }
@@ -1507,6 +1512,11 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
15071512
n2.isBefore(getParameterPatternOrBodyEntry(c, _, 1))
15081513
or
15091514
exists(CallableContextOption ctx, Parameter p, int i | p = getRankedParameter(c, ctx, i) |
1515+
exists(p.getDefaultValue()) and
1516+
p.getPattern() = p and
1517+
n1.isBefore(p) and
1518+
n2.isAfter(p)
1519+
or
15101520
exists(MatchingSuccessor t |
15111521
n1.isAfterValue(p.getPattern(), t) and
15121522
if t.isMatch()

0 commit comments

Comments
 (0)