authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2023-05-10 21:07:40+02:00
committergravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2023-05-10 21:07:40+02:00
log2d2d79a05b8423c7638348dc5a89793c1e0cafce
tree31af8f8edfd6a06c4f2de886a31ead7cf0db79ce
parentac385bd8a6bc79c7d7bd3a568dde5002ebb34e08

autodoc: fix crash when call syntax has complex callee expression


1 files changed, 13 insertions(+), 1 deletions(-)

src/Autodoc.zig+13-1
...@@ -2396,7 +2396,19 @@ fn walkInstruction(...@@ -2396,7 +2396,19 @@ fn walkInstruction(
23962396
2397 return DocData.WalkResult{2397 return DocData.WalkResult{
2398 .typeRef = if (callee.typeRef) |tr| switch (tr) {2398 .typeRef = if (callee.typeRef) |tr| switch (tr) {
2399 .type => |func_type_idx| self.types.items[func_type_idx].Fn.ret,2399 .type => |func_type_idx| switch (self.types.items[func_type_idx]) {
2400 .Fn => |func| func.ret,
2401 else => blk: {
2402 printWithContext(
2403 file,
2404 inst_index,
2405 "unexpected callee type in walkInstruction.call: `{s}`\n",
2406 .{@tagName(self.types.items[func_type_idx])},
2407 );
2408
2409 break :blk null;
2410 },
2411 },
2400 else => null,2412 else => null,
2401 } else null,2413 } else null,
2402 .expr = .{ .call = call_slot_index },2414 .expr = .{ .call = call_slot_index },