const WipDecls = struct 3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965const WipDecls = struct {
astgen: *AstGen,
slice: Scratch.Slice,
index: u32,
fn init(scratch: *Scratch, decls_len: u32) Allocator.Error!WipDecls {
return .{
.astgen = scratch.astgen,
.slice = try scratch.addSlice(decls_len),
.index = 0,
};
}
fn finish(wip: *WipDecls) void {
assert(wip.index == wip.slice.len);
wip.* = undefined;
}
fn nextDecl(wip: *WipDecls, decl_inst: Zir.Inst.Index) void {
wip.slice.get(wip.astgen)[wip.index] = @backingInt(decl_inst);
wip.index += 1;
}
}