Skip to content

Commit 738c91f

Browse files
authored
Merge pull request #22489 from aschackmull/cfg/rename-foreach
CFG: Rename ForeachStmt to ForEachStmt.
2 parents 4f153c6 + 53f30a0 commit 738c91f

6 files changed

Lines changed: 13 additions & 13 deletions

File tree

csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ module Ast implements AstSig<Location> {
190190

191191
final private class FinalForeachStmt = CS::ForeachStmt;
192192

193-
class ForeachStmt extends FinalForeachStmt {
193+
class ForEachStmt extends FinalForeachStmt {
194194
Expr getVariable() {
195195
result = this.getVariableDeclExpr() or result = this.getVariableDeclTuple()
196196
}

java/ql/lib/semmle/code/java/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private module Ast implements AstSig<Location> {
100100

101101
final private class FinalEnhancedForStmt = J::EnhancedForStmt;
102102

103-
class ForeachStmt extends FinalEnhancedForStmt {
103+
class ForEachStmt extends FinalEnhancedForStmt {
104104
Expr getVariable() { result = super.getVariable() }
105105

106106
Expr getCollection() { result = super.getExpr() }

python/ql/lib/semmle/python/controlflow/internal/AstNodeImpl.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,10 @@ module Ast implements AstSig<Py::Location> {
657657
}
658658

659659
/** A for-each loop (`for x in iterable:`). */
660-
class ForeachStmt extends LoopStmtImpl {
660+
class ForEachStmt extends LoopStmtImpl {
661661
private Py::For forStmt;
662662

663-
ForeachStmt() { this = TPyStmt(forStmt) }
663+
ForEachStmt() { this = TPyStmt(forStmt) }
664664

665665
/** Gets the loop variable. */
666666
Expr getVariable() { result.asExpr() = forStmt.getTarget() }
@@ -898,7 +898,7 @@ module Ast implements AstSig<Py::Location> {
898898
AstNode getLoopElse(LoopStmt loop) {
899899
result = loop.(WhileStmt).getElse()
900900
or
901-
result = loop.(ForeachStmt).getElse()
901+
result = loop.(ForEachStmt).getElse()
902902
}
903903

904904
/** An exception handler (`except` or `except*`). */

ruby/ql/lib/codeql/ruby/controlflow/ControlFlowGraph.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ private module Ast implements AstSig<Location> {
295295
AstNode getUpdate(int index) { none() }
296296
}
297297

298-
// `ForExpr` would be a match for `ForeachStmt`, but it is desugared.
299-
class ForeachStmt extends LoopStmt {
300-
ForeachStmt() { none() }
298+
// `ForExpr` would be a match for `ForEachStmt`, but it is desugared.
299+
class ForEachStmt extends LoopStmt {
300+
ForEachStmt() { none() }
301301

302302
Expr getVariable() { none() }
303303

shared/controlflow/codeql/controlflow/ControlFlowGraph.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ signature module AstSig<LocationSig Location> {
147147
}
148148

149149
/** A for-loop that iterates over the elements of a collection. */
150-
class ForeachStmt extends LoopStmt {
150+
class ForEachStmt extends LoopStmt {
151151
/** Gets the variable declaration of this `foreach` loop. */
152152
Expr getVariable();
153153

@@ -650,7 +650,7 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
650650
any(Case case).getGuard() = n
651651
)
652652
or
653-
any(ForeachStmt foreachstmt).getCollection() = n and kind.isEmptiness()
653+
any(ForEachStmt foreachstmt).getCollection() = n and kind.isEmptiness()
654654
or
655655
kind.isMatching() and
656656
(
@@ -1656,7 +1656,7 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
16561656
n2.isAfter(loopstmt)
16571657
)
16581658
or
1659-
exists(ForeachStmt foreachstmt |
1659+
exists(ForEachStmt foreachstmt |
16601660
n1.isBefore(foreachstmt) and
16611661
n2.isBefore(foreachstmt.getCollection())
16621662
or
@@ -2401,7 +2401,7 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
24012401
// allow for loop headers in foreach loops (they're checking emptiness on the iterator, not the collection)
24022402
not (
24032403
t instanceof DirectSuccessor and
2404-
node.isAdditional(any(ForeachStmt foreach), loopHeaderTag())
2404+
node.isAdditional(any(ForEachStmt foreach), loopHeaderTag())
24052405
) and
24062406
// allow for functions with multiple bodies
24072407
not exists(Callable c |

unified/ql/lib/codeql/unified/internal/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private module Ast implements AstSig<Location> {
123123
AstNode getUpdate(int index) { none() }
124124
}
125125

126-
class ForeachStmt extends LoopStmt instanceof U::ForEachStmt {
126+
class ForEachStmt extends LoopStmt instanceof U::ForEachStmt {
127127
override Stmt getBody() { result = U::ForEachStmt.super.getBody() }
128128

129129
// TODO support foreach guard

0 commit comments

Comments
 (0)