From bb1fa0bdbd7235308362528e5c1ca408681064e9 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Wed, 9 Mar 2022 12:24:18 +0200 Subject: Sema: handle noreturn result in condbr_inline --- src/Module.zig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index b7299ebdab..936e912e59 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -3739,9 +3739,8 @@ fn semaDecl(mod: *Module, decl: *Decl) !bool { const inst_data = zir_datas[zir_block_index].pl_node; const extra = zir.extraData(Zir.Inst.Block, inst_data.payload_index); const body = zir.extra[extra.end..][0..extra.data.body_len]; - const break_index = try sema.analyzeBody(&block_scope, body); + const result_ref = (try sema.analyzeBodyBreak(&block_scope, body)).?.operand; try wip_captures.finalize(); - const result_ref = zir_datas[break_index].@"break".operand; const src: LazySrcLoc = .{ .node_offset = 0 }; const decl_tv = try sema.resolveInstValue(&block_scope, src, result_ref); const align_val = blk: { @@ -4681,12 +4680,11 @@ pub fn analyzeFnBody(mod: *Module, decl: *Decl, func: *Fn, arena: Allocator) Sem func.state = .in_progress; log.debug("set {s} to in_progress", .{decl.name}); - _ = sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) { + sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) { // TODO make these unreachable instead of @panic error.NeededSourceLocation => @panic("zig compiler bug: NeededSourceLocation"), error.GenericPoison => @panic("zig compiler bug: GenericPoison"), error.ComptimeReturn => @panic("zig compiler bug: ComptimeReturn"), - error.ComptimeBreak => @panic("zig compiler bug: ComptimeBreak"), else => |e| return e, }; -- cgit v1.2.3