AstGen: fix loop control flow applying to wrong loop

In the case of 'continue' or 'break' inside the 'else' block of a
'while' or 'for' loop.

Closes #12109
This commit is contained in:
Andrew Kelley
2022-07-13 15:59:46 -07:00
parent 1fee9eac8b
commit fad95741db
5 changed files with 35 additions and 4 deletions

View File

@@ -334,3 +334,13 @@ test "continue inline while loop" {
}
comptime assert(i == 5);
}
test "else continue outer while" {
var i: usize = 0;
while (true) {
i += 1;
while (i > 5) {
return;
} else continue;
}
}