motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit 2dcaed743f27a7c53f1fa742fdc42ddd77fe15f4 (tree)
parent 66a46888bbf8636c4ba9e59544fc3679d39a32f6
Author: Loris Cro <kappaloris@gmail.com>
Date:   Sat, 29 Jan 2022 18:45:45 +0100

autodocs: add support for block_inline

Diffstat:
Msrc/Autodoc.zig | 20++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/Autodoc.zig b/src/Autodoc.zig @@ -242,11 +242,15 @@ fn walkInstruction( }, .block_inline => { const pl_node = data[inst_index].pl_node; - const body_len = zir.extra[pl_node.payload_index]; + const extra = zir.extraData(Zir.Inst.Block, pl_node.payload_index); + const break_index = zir.extra[extra.end..][extra.data.body_len - 1]; - std.debug.print("body len: {}\n", .{body_len}); + std.debug.print("[instr: {}] body len: {} last instr idx: {}\n", .{ + inst_index, + extra.data.body_len, + break_index, + }); - const break_index = inst_index + body_len; const break_operand = data[break_index].@"break".operand; return if (Zir.refToIndex(break_operand)) |bi| walkInstruction(zir, gpa, parent_scope, types, decls, ast_nodes, bi) @@ -559,7 +563,15 @@ fn collectFieldInfo( try field_type_indexes.append(DocData.WalkResult{ .failure = true }); } else { const zir_index = enum_value - Zir.Inst.Ref.typed_value_map.len; - const walk_result = try walkInstruction(zir, gpa, scope, types, decls, ast_nodes, zir_index); + const walk_result = try walkInstruction( + zir, + gpa, + scope, + types, + decls, + ast_nodes, + zir_index, + ); try field_type_indexes.append(walk_result); } },