fn makeDeclaration(gz: *GenZir, node: Ast.Node.Index) !Zir.Inst.Index 12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399 fn makeDeclaration(gz: *GenZir, node: Ast.Node.Index) !Zir.Inst.Index {
const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len));
try gz.astgen.instructions.append(gz.astgen.gpa, .{
.tag = .declaration,
.data = .{ .declaration = .{
.src_node = node,
.payload_index = undefined,
} },
});
return new_index;
}
Note that this returns a
Zir.Inst.Indexnot a ref. Does not append the block instruction to the scope. Leaves thepayload_indexfield undefined. UsesetDeclarationto finalize.