Skip to content

Commit dd005e5

Browse files
baywetmichaelnebel
andauthored
chore: applies review suggestion
Co-authored-by: Michael Nebel <michaelnebel@github.com>
1 parent 5e11c9a commit dd005e5

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

csharp/ql/lib/Linq/Helpers.qll

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,23 @@ private int numStmts(ForeachStmt fes) {
2121
}
2222

2323
private predicate terminatesCallable(Stmt s) {
24-
s.stripSingletonBlocks() instanceof ReturnStmt
25-
or
26-
s.stripSingletonBlocks() instanceof YieldBreakStmt
27-
or
28-
s.stripSingletonBlocks() instanceof ThrowStmt
29-
or
30-
s.stripSingletonBlocks() instanceof BreakStmt
31-
or
32-
exists(BlockStmt b | b = s.stripSingletonBlocks() | terminatesCallable(b.getLastStmt()))
33-
or
34-
exists(IfStmt nested |
35-
nested = s.stripSingletonBlocks() and
36-
exists(nested.getElse()) and
37-
terminatesCallable(nested.getThen()) and
38-
terminatesCallable(nested.getElse())
24+
exists(Stmt stripped | stripped = s.stripSingletonBlocks() |
25+
stripped instanceof ReturnStmt
26+
or
27+
stripped instanceof YieldBreakStmt
28+
or
29+
stripped instanceof ThrowStmt
30+
or
31+
stripped instanceof BreakStmt
32+
or
33+
stripped = any(BlockStmt b | terminatesCallable(b.getLastStmt()))
34+
or
35+
stripped =
36+
any(IfStmt nested |
37+
exists(nested.getElse()) and
38+
terminatesCallable(nested.getThen()) and
39+
terminatesCallable(nested.getElse())
40+
)
3941
)
4042
}
4143

0 commit comments

Comments
 (0)