From 0e4da9517e4c356c0a69158545f055efcc995291 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Mon, 12 Oct 2026 11:12:09 +0200 Subject: [PATCH] CFG: Handle parameter cfg explicitly. --- .../codeql/controlflow/ControlFlowGraph.qll | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll index 99c7db99416b..35955da8f08e 100644 --- a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll +++ b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll @@ -689,6 +689,11 @@ module Make0 Ast> { not postOrInOrder(n) and not additionalNode(n, _, _) and not inConditionalContext(n, _) + or + // A parameter pattern represented by the parameter itself should not be + // considered to have child nodes. + n.(Parameter).getPattern() = n and + not inConditionalContext(n, _) } private string catchClauseEmptyBodyTag() { result = "[CatchClauseEmptyBody]" } @@ -1507,6 +1512,11 @@ module Make0 Ast> { n2.isBefore(getParameterPatternOrBodyEntry(c, _, 1)) or exists(CallableContextOption ctx, Parameter p, int i | p = getRankedParameter(c, ctx, i) | + exists(p.getDefaultValue()) and + p.getPattern() = p and + n1.isBefore(p) and + n2.isAfter(p) + or exists(MatchingSuccessor t | n1.isAfterValue(p.getPattern(), t) and if t.isMatch()