Skip to content

Commit 2d2d79a

Browse files
committed
autodoc: fix crash when call syntax has complex callee expression
1 parent ac385bd commit 2d2d79a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Autodoc.zig

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2396,7 +2396,19 @@ fn walkInstruction(
23962396

23972397
return DocData.WalkResult{
23982398
.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+
},
24002412
else => null,
24012413
} else null,
24022414
.expr = .{ .call = call_slot_index },

0 commit comments

Comments
 (0)