Skip to content

Commit 5ffb8ec

Browse files
committed
Shared: Support exceptions in parameter defaults.
1 parent 122101c commit 5ffb8ec

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

shared/controlflow/codeql/controlflow/ControlFlowGraph.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,14 +1269,20 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
12691269
result = block.(Switch).getStmt(_)
12701270
}
12711271

1272+
private predicate callableHasParamDefault(Callable c, Expr defaultValue) {
1273+
exists(Parameter p | p.getDefaultValue() = defaultValue and c = getEnclosingCallable(p))
1274+
}
1275+
12721276
/**
12731277
* Holds if an abrupt completion `c` from within `ast` is caught with
12741278
* flow continuing at `n`.
12751279
*/
12761280
private predicate endAbruptCompletion(AstNode ast, PreControlFlowNode n, AbruptCompletion c) {
12771281
Input2::endAbruptCompletion(ast, n, c)
12781282
or
1279-
exists(Callable callable | callableHasBodyPart(callable, ast) |
1283+
exists(Callable callable |
1284+
callableHasBodyPart(callable, ast) or callableHasParamDefault(callable, ast)
1285+
|
12801286
c.getSuccessorType() instanceof ReturnSuccessor and
12811287
n.(NormalExitNodeImpl).getEnclosingCallable() = callable
12821288
or

0 commit comments

Comments
 (0)