authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2022-01-29 18:45:45+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:10:10-07:00
log2dcaed743f27a7c53f1fa742fdc42ddd77fe15f4
treee556b4e049b070dfee77bbe29eb719e47494cbf9
parent66a46888bbf8636c4ba9e59544fc3679d39a32f6

autodocs: add support for block_inline


1 files changed, 16 insertions(+), 4 deletions(-)

src/Autodoc.zig+16-4
...@@ -242,11 +242,15 @@ fn walkInstruction(...@@ -242,11 +242,15 @@ fn walkInstruction(
242 },242 },
243 .block_inline => {243 .block_inline => {
244 const pl_node = data[inst_index].pl_node;244 const pl_node = data[inst_index].pl_node;
245 const body_len = zir.extra[pl_node.payload_index];245 const extra = zir.extraData(Zir.Inst.Block, pl_node.payload_index);
246 const break_index = zir.extra[extra.end..][extra.data.body_len - 1];
246247
247 std.debug.print("body len: {}\n", .{body_len});248 std.debug.print("[instr: {}] body len: {} last instr idx: {}\n", .{
249 inst_index,
250 extra.data.body_len,
251 break_index,
252 });
248253
249 const break_index = inst_index + body_len;
250 const break_operand = data[break_index].@"break".operand;254 const break_operand = data[break_index].@"break".operand;
251 return if (Zir.refToIndex(break_operand)) |bi|255 return if (Zir.refToIndex(break_operand)) |bi|
252 walkInstruction(zir, gpa, parent_scope, types, decls, ast_nodes, bi)256 walkInstruction(zir, gpa, parent_scope, types, decls, ast_nodes, bi)
...@@ -559,7 +563,15 @@ fn collectFieldInfo(...@@ -559,7 +563,15 @@ fn collectFieldInfo(
559 try field_type_indexes.append(DocData.WalkResult{ .failure = true });563 try field_type_indexes.append(DocData.WalkResult{ .failure = true });
560 } else {564 } else {
561 const zir_index = enum_value - Zir.Inst.Ref.typed_value_map.len;565 const zir_index = enum_value - Zir.Inst.Ref.typed_value_map.len;
562 const walk_result = try walkInstruction(zir, gpa, scope, types, decls, ast_nodes, zir_index);566 const walk_result = try walkInstruction(
567 zir,
568 gpa,
569 scope,
570 types,
571 decls,
572 ast_nodes,
573 zir_index,
574 );
563 try field_type_indexes.append(walk_result);575 try field_type_indexes.append(walk_result);
564 }576 }
565 },577 },