From b4d4d19958d6b8fd855401aeb8691205a134f7a3 Mon Sep 17 00:00:00 2001 From: Krzysztof Wolicki Date: Sun, 22 Oct 2023 16:15:56 +0200 Subject: [PATCH] autodoc: Add support for struct_init_empty_ref_result (#17476) --- src/Autodoc.zig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Autodoc.zig b/src/Autodoc.zig index 5a241e51ab..239cefa45d 100644 --- a/src/Autodoc.zig +++ b/src/Autodoc.zig @@ -2897,6 +2897,26 @@ fn walkInstruction( .expr = .{ .@"struct" = &.{} }, }; }, + .struct_init_empty_ref_result => { + const un_node = data[inst_index].un_node; + + var operand: DocData.WalkResult = try self.walkRef( + file, + parent_scope, + parent_src, + un_node.operand, + false, + call_ctx, + ); + + const struct_init_idx = self.exprs.items.len; + try self.exprs.append(self.arena, .{ .@"struct" = &.{} }); + + return DocData.WalkResult{ + .typeRef = operand.expr, + .expr = .{ .@"&" = struct_init_idx }, + }; + }, .struct_init_anon => { const pl_node = data[inst_index].pl_node; const extra = file.zir.extraData(Zir.Inst.StructInitAnon, pl_node.payload_index);