mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Sema: evaluate switch items at comptime
This commit is contained in:
@@ -13210,6 +13210,12 @@ fn resolveSwitchItem(
|
||||
// The result location of item bodies is `.{ .coerce_ty = switch_inst }`.
|
||||
sema.inst_map.putAssumeCapacity(switch_inst, .fromType(item_ty));
|
||||
defer assert(sema.inst_map.remove(switch_inst));
|
||||
const old_comptime_reason = block.comptime_reason;
|
||||
defer block.comptime_reason = old_comptime_reason;
|
||||
block.comptime_reason = .{ .reason = .{
|
||||
.src = item_src,
|
||||
.r = .{ .simple = .switch_item },
|
||||
} };
|
||||
break :ref try sema.resolveInlineBody(block, body, switch_inst);
|
||||
};
|
||||
break :uncoerced .{ uncoerced, sema.typeOf(uncoerced) };
|
||||
|
||||
Reference in New Issue
Block a user