JavaScript: fix CFG for EnhancedForStmt

This commit is contained in:
Asger F
2018-09-06 10:39:37 +01:00
parent ec7beab9fa
commit 3d444f3dc6
2 changed files with 17 additions and 0 deletions

View File

@@ -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. */

View File

@@ -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");
}
}