diff options
| author | Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com> | 2023-11-26 10:21:58 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-26 02:21:58 -0500 |
| commit | 2ff707be789046a733d0d23c6fe42dd2b7210396 (patch) | |
| tree | 48b0c105859d1ff21cb7de70aedacd6f02006b1b /src | |
| parent | 2252dcc508c53dc302ec1f919c4792a7f00ce125 (diff) | |
| download | zig-2ff707be789046a733d0d23c6fe42dd2b7210396.tar.gz zig-2ff707be789046a733d0d23c6fe42dd2b7210396.zip | |
AstGen: check allowed non-function builtins with declarative field (#18120)
Diffstat (limited to 'src')
| -rw-r--r-- | src/AstGen.zig | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index 8a6a6a7292..060e2af62b 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -8268,25 +8268,8 @@ fn builtinCall( // Check function scope-only builtins - if (astgen.fn_block == null) { - switch (info.tag) { - .c_va_arg, - .c_va_copy, - .c_va_end, - .c_va_start, - .work_item_id, - .work_group_size, - .work_group_id, - .set_align_stack, - .set_cold, - .return_address, - .frame_address, - .breakpoint, - .src, - => return astgen.failNode(node, "'{s}' outside function scope", .{builtin_name}), - else => {}, - } - } + if (astgen.fn_block == null and info.illegal_outside_function) + return astgen.failNode(node, "'{s}' outside function scope", .{builtin_name}); switch (info.tag) { .import => { |
