Skip to content

Commit 8f0b7f0

Browse files
committed
Rust: Use propagatesAbnormal in two places
1 parent c4eafb2 commit 8f0b7f0

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr {
369369

370370
override predicate entry(AstNode node) { this.first(node) }
371371

372+
override predicate propagatesAbnormal(AstNode child) { child = super.getCondition() }
373+
372374
override predicate first(AstNode node) { first(super.getCondition(), node) }
373375

374376
private ConditionalCompletion conditionCompletion(Completion c) {
@@ -388,13 +390,6 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr {
388390
this.conditionCompletion(c).failed() and
389391
succ = this
390392
}
391-
392-
override predicate last(AstNode last, Completion c) {
393-
super.last(last, c)
394-
or
395-
last(super.getCondition(), last, c) and
396-
not completionIsNormal(c)
397-
}
398393
}
399394

400395
class ForExprTree extends LoopingExprTree instanceof ForExpr {
@@ -404,6 +399,8 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr {
404399

405400
override predicate entry(AstNode n) { first(super.getPat(), n) }
406401

402+
override predicate propagatesAbnormal(AstNode child) { child = super.getIterable() }
403+
407404
override predicate first(AstNode node) { first(super.getIterable(), node) }
408405

409406
override predicate succ(AstNode pred, AstNode succ, Completion c) {
@@ -421,13 +418,6 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr {
421418
c.(MatchCompletion).failed() and
422419
succ = this
423420
}
424-
425-
override predicate last(AstNode last, Completion c) {
426-
super.last(last, c)
427-
or
428-
last(super.getIterable(), last, c) and
429-
not completionIsNormal(c)
430-
}
431421
}
432422

433423
// TODO: replace with expanded macro once the extractor supports it

0 commit comments

Comments
 (0)