stage2: switch comptime execution

This commit is contained in:
Vexu
2020-10-20 22:00:30 +03:00
parent 12e4c648cc
commit 769d5a9c43
5 changed files with 82 additions and 39 deletions

View File

@@ -2122,16 +2122,18 @@ pub fn addSwitchBr(
src: usize,
target_ptr: *Inst,
cases: []Inst.SwitchBr.Case,
else_body: ir.Body,
) !*Inst {
const inst = try block.arena.create(Inst.SwitchBr);
inst.* = .{
.base = .{
.tag = .switchbr,
.ty = Type.initTag(.void),
.ty = Type.initTag(.noreturn),
.src = src,
},
.target_ptr = target_ptr,
.cases = cases,
.else_body = else_body,
};
try block.instructions.append(self.gpa, &inst.base);
return &inst.base;