mirror of
https://github.com/github/codeql.git
synced 2026-05-24 08:07:07 +02:00
Merge pull request #21880 from owen-mc/shared/cfg/for-loop-stmt-init-update
Shared CFG: Make the init and update parts of a for loop statements
This commit is contained in:
@@ -175,7 +175,9 @@ module Ast implements AstSig<Location> {
|
||||
final private class FinalForStmt = CS::ForStmt;
|
||||
|
||||
class ForStmt extends FinalForStmt {
|
||||
Expr getInit(int index) { result = this.getInitializer(index) }
|
||||
AstNode getInit(int index) { result = super.getInitializer(index) }
|
||||
|
||||
AstNode getUpdate(int index) { result = super.getUpdate(index) }
|
||||
}
|
||||
|
||||
final private class FinalForeachStmt = CS::ForeachStmt;
|
||||
|
||||
@@ -84,7 +84,13 @@ private module Ast implements AstSig<Location> {
|
||||
|
||||
class DoStmt = J::DoStmt;
|
||||
|
||||
class ForStmt = J::ForStmt;
|
||||
final private class FinalForStmt = J::ForStmt;
|
||||
|
||||
class ForStmt extends FinalForStmt {
|
||||
AstNode getInit(int index) { result = super.getInit(index) }
|
||||
|
||||
AstNode getUpdate(int index) { result = super.getUpdate(index) }
|
||||
}
|
||||
|
||||
final private class FinalEnhancedForStmt = J::EnhancedForStmt;
|
||||
|
||||
|
||||
@@ -118,14 +118,14 @@ signature module AstSig<LocationSig Location> {
|
||||
|
||||
/** A traditional C-style `for` loop. */
|
||||
class ForStmt extends LoopStmt {
|
||||
/** Gets the initializer expression of the loop at the specified (zero-based) position, if any. */
|
||||
Expr getInit(int index);
|
||||
/** Gets the initializer of the loop at the specified (zero-based) position, if any. */
|
||||
AstNode getInit(int index);
|
||||
|
||||
/** Gets the boolean condition of this `for` loop. */
|
||||
Expr getCondition();
|
||||
|
||||
/** Gets the update expression of this loop at the specified (zero-based) position, if any. */
|
||||
Expr getUpdate(int index);
|
||||
/** Gets the update of this loop at the specified (zero-based) position, if any. */
|
||||
AstNode getUpdate(int index);
|
||||
}
|
||||
|
||||
/** A for-loop that iterates over the elements of a collection. */
|
||||
|
||||
Reference in New Issue
Block a user