fn setBlockBody(gz: *GenZir, inst: Zir.Inst.Index) !void 11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451 fn setBlockBody(gz: *GenZir, inst: Zir.Inst.Index) !void {
const astgen = gz.astgen;
const gpa = astgen.gpa;
const body = gz.instructionsSlice();
const body_len = astgen.countBodyLenAfterFixups(body);
const zir_tags = astgen.instructions.items(.tag);
assert(zir_tags[@backingInt(inst)] != .block_comptime); // use `setComptimeBlockBody` instead
try astgen.extra.ensureUnusedCapacity(
gpa,
@typeInfo(Zir.Inst.Block).@"struct".field_names.len + body_len,
);
const zir_datas = astgen.instructions.items(.data);
zir_datas[@backingInt(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity(
Zir.Inst.Block{ .body_len = body_len },
);
astgen.appendBodyWithFixups(body);
gz.unstack();
}
Assumes nothing stacked on
gz. Unstacksgz. Assertsinstis not ablock_comptime.