From 2252dcc508c53dc302ec1f919c4792a7f00ce125 Mon Sep 17 00:00:00 2001 From: Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com> Date: Sat, 25 Nov 2023 20:29:07 +0300 Subject: Compiler: move checking function-scope-only builtins to AstGen --- src/Sema.zig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/Sema.zig') diff --git a/src/Sema.zig b/src/Sema.zig index 87790dbdb1..4a30c6d695 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -6151,9 +6151,6 @@ fn zirSetAlignStack(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst alignment.toByteUnitsOptional().?, }); } - if (sema.func_index == .none) { - return sema.fail(block, src, "@setAlignStack outside function body", .{}); - } const fn_owner_decl = mod.funcOwnerDeclPtr(sema.func_index); switch (fn_owner_decl.ty.fnCallingConvention(mod)) { @@ -16780,13 +16777,12 @@ fn zirBuiltinSrc( block: *Block, extended: Zir.Inst.Extended.InstData, ) CompileError!Air.Inst.Ref { + _ = block; const tracy = trace(@src()); defer tracy.end(); const mod = sema.mod; const extra = sema.code.extraData(Zir.Inst.Src, extended.operand).data; - const src = LazySrcLoc.nodeOffset(extra.node); - if (sema.func_index == .none) return sema.fail(block, src, "@src outside function", .{}); const fn_owner_decl = mod.funcOwnerDeclPtr(sema.func_index); const ip = &mod.intern_pool; const gpa = sema.gpa; -- cgit v1.2.3