find references in while continue expressions (#758)

This commit is contained in:
Techatrix 2022-11-16 23:35:51 +01:00 committed by GitHub
parent 46da74d32e
commit 31584cff60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -202,6 +202,7 @@ fn symbolReferencesInternal(
const loop = ast.whileAst(tree, node).?;
try symbolReferencesInternal(builder, loop.ast.cond_expr, handle, false);
try symbolReferencesInternal(builder, loop.ast.then_expr, handle, false);
try symbolReferencesInternal(builder, loop.ast.cont_expr, handle, false);
try symbolReferencesInternal(builder, loop.ast.else_expr, handle, false);
},
.@"if",

View File

@ -74,6 +74,15 @@ test "references - local scope" {
);
}
test "references - while continue expression" {
try testReferences(
\\ pub fn foo() void {
\\ var <0>: u32 = 0;
\\ while (true) : (<0> += 1) {}
\\ }
);
}
test "references - label" {
if (skip_references_tests) return error.SkipZigTest;
try testReferences(