Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion java/ql/lib/semmle/code/java/ControlFlowGraph.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions shared/controlflow/codeql/controlflow/ControlFlowGraph.qll
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment on lines +121 to +128
}

/** A for-loop that iterates over the elements of a collection. */
Expand Down
Loading