fn setBreakResultInfo(gz: *GenZir, parent_ri: AstGen.ResultInfo) void 11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409 fn setBreakResultInfo(gz: *GenZir, parent_ri: AstGen.ResultInfo) void {
// Depending on whether the result location is a pointer or value, different
// ZIR needs to be generated. In the former case we rely on storing to the
// pointer to communicate the result, and use breakvoid; in the latter case
// the block break instructions will have the result values.
switch (parent_ri.rl) {
.coerced_ty => |ty_inst| {
// Type coercion needs to happen before breaks.
gz.break_result_info = .{ .rl = .{ .ty = ty_inst }, .ctx = parent_ri.ctx };
},
.discard => {
// We don't forward the result context here. This prevents
// "unnecessary discard" errors from being caused by expressions
// far from the actual discard, such as a `break` from a
// discarded block.
gz.break_result_info = .{ .rl = .discard };
},
else => {
gz.break_result_info = parent_ri;
},
}
}