mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
JavaScript: fix CFG for EnhancedForStmt
This commit is contained in:
@@ -607,6 +607,10 @@ abstract class EnhancedForLoop extends LoopStmt {
|
||||
override Stmt getBody() {
|
||||
result = getChildStmt(2)
|
||||
}
|
||||
|
||||
override ControlFlowNode getFirstControlFlowNode() {
|
||||
result = getIteratorExpr().getFirstControlFlowNode()
|
||||
}
|
||||
}
|
||||
|
||||
/** A `for`-`in` loop. */
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
function f() {
|
||||
let y = false;
|
||||
for (const x of [1, 2, 3]) {
|
||||
if (x > 0) {
|
||||
y = true; // OK
|
||||
continue;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!y) {
|
||||
console.log("Hello");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user