fix: add .break_inline ir instruction to ensure interned values can be referenced
This commit is contained in:
parent
aad95a75ee
commit
01cc996183
4 changed files with 15 additions and 4 deletions
|
|
@ -1173,7 +1173,7 @@ fn choiceStmt(gi: *GenIr, scope: *Scope, node: *const Ast.Node) InnerError!void
|
|||
}
|
||||
}
|
||||
|
||||
var body_block = gi.makeSubBlock();
|
||||
var body_block = block_3.makeSubBlock();
|
||||
defer body_block.unstack();
|
||||
|
||||
if (trailing_divert) |trailing| {
|
||||
|
|
@ -1190,7 +1190,7 @@ fn choiceStmt(gi: *GenIr, scope: *Scope, node: *const Ast.Node) InnerError!void
|
|||
const rhs_body = block_3.instructionsSliceUpto(&body_block);
|
||||
const body = body_block.instructionsSlice();
|
||||
const case_extra_len =
|
||||
@typeInfo(Ir.Inst.SwitchBr.Case).@"struct".fields.len +
|
||||
@typeInfo(Ir.Inst.ChoiceBr.Case).@"struct".fields.len +
|
||||
lhs_body.len + mhs_body.len + rhs_body.len + body.len;
|
||||
|
||||
try astgen.extra.ensureUnusedCapacity(gpa, case_extra_len);
|
||||
|
|
@ -1441,9 +1441,10 @@ fn varDecl(gi: *GenIr, scope: *Scope, decl_node: *const Ast.Node) !void {
|
|||
var decl_block = gi.makeSubBlock();
|
||||
defer decl_block.unstack();
|
||||
|
||||
const var_inst = try decl_block.makePayloadNode(.decl_var);
|
||||
_ = try expr(&decl_block, scope, expr_node);
|
||||
const name_str = try astgen.strFromNode(identifier_node);
|
||||
const var_inst = try decl_block.makePayloadNode(.decl_var);
|
||||
const rvalue_inst = try expr(&decl_block, scope, expr_node);
|
||||
_ = try decl_block.addBinaryNode(.break_inline, var_inst.toRef(), rvalue_inst);
|
||||
|
||||
try setDeclVarPayload(var_inst, &decl_block, identifier_node);
|
||||
try setDeclaration(decl_inst, .{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue