zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 2d2d79a05b8423c7638348dc5a89793c1e0cafce (tree)
parent ac385bd8a6bc79c7d7bd3a568dde5002ebb34e08
Author: Loris Cro <kappaloris@gmail.com>
Date:   Wed, 10 May 2023 21:07:40 +0200

autodoc: fix crash when call syntax has complex callee expression

Diffstat:
Msrc/Autodoc.zig | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/Autodoc.zig b/src/Autodoc.zig @@ -2396,7 +2396,19 @@ fn walkInstruction( return DocData.WalkResult{ .typeRef = if (callee.typeRef) |tr| switch (tr) { - .type => |func_type_idx| self.types.items[func_type_idx].Fn.ret, + .type => |func_type_idx| switch (self.types.items[func_type_idx]) { + .Fn => |func| func.ret, + else => blk: { + printWithContext( + file, + inst_index, + "unexpected callee type in walkInstruction.call: `{s}`\n", + .{@tagName(self.types.items[func_type_idx])}, + ); + + break :blk null; + }, + }, else => null, } else null, .expr = .{ .call = call_slot_index },