From a23ab331a28d865e3ea636c9033db4de345f8653 Mon Sep 17 00:00:00 2001 From: Loris Cro Date: Wed, 14 Feb 2024 15:35:00 +0100 Subject: [PATCH] autodoc: fix analysis of closure_get instructions --- src/Autodoc.zig | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Autodoc.zig b/src/Autodoc.zig index fb027567eb03..e5f0993bcbaf 100644 --- a/src/Autodoc.zig +++ b/src/Autodoc.zig @@ -1153,14 +1153,15 @@ fn walkInstruction( }, .closure_get => { const inst_node = data[@intFromEnum(inst)].inst_node; - return try self.walkInstruction( - file, - parent_scope, - parent_src, - inst_node.inst, - need_type, - call_ctx, - ); + + const code = try self.getBlockSource(file, parent_src, inst_node.src_node); + const idx = self.comptime_exprs.items.len; + try self.exprs.append(self.arena, .{ .comptimeExpr = idx }); + try self.comptime_exprs.append(self.arena, .{ .code = code }); + + return DocData.WalkResult{ + .expr = .{ .comptimeExpr = idx }, + }; }, .closure_capture => { const un_tok = data[@intFromEnum(inst)].un_tok;