Function block [src]
Prototype
pub fn block(self: *WipFunction, incoming: u32, name: []const u8) Allocator.Error!Block.Index
Parameters
self: *WipFunction
incoming: u32
name: []const u8
Source
pub fn block(self: *WipFunction, incoming: u32, name: []const u8) Allocator.Error!Block.Index {
try self.blocks.ensureUnusedCapacity(self.builder.gpa, 1);
const index: Block.Index = @enumFromInt(self.blocks.items.len);
const final_name = if (self.strip) .empty else try self.builder.string(name);
self.blocks.appendAssumeCapacity(.{
.name = final_name,
.incoming = incoming,
.instructions = .{},
});
return index;
}