| ... | ... | @@ -47,6 +47,19 @@ pub fn generateZirData(self: Autodoc) !void { |
| 47 | 47 | .kind = 0, |
| 48 | 48 | .name = "type", |
| 49 | 49 | }); |
| 50 | // append all the types in Zir.Inst.Ref |
| 51 | { |
| 52 | // we don't count .none |
| 53 | var i: u32 = 1; |
| 54 | while (i <= @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type)) : (i += 1) { |
| 55 | var tmpbuf = std.ArrayList(u8).init(gpa); |
| 56 | try Zir.Inst.Ref.typed_value_map[i].val.format("", .{}, tmpbuf.writer()); |
| 57 | try types.append(.{ |
| 58 | .kind = 0, |
| 59 | .name = tmpbuf.toOwnedSlice(), |
| 60 | }); |
| 61 | } |
| 62 | } |
| 50 | 63 | |
| 51 | 64 | var root_scope: Scope = .{ .parent = null }; |
| 52 | 65 | try ast_nodes.append(.{ .name = "(root)" }); |
| ... | ... | @@ -233,8 +246,15 @@ fn walkInstruction( |
| 233 | 246 | |
| 234 | 247 | std.debug.print("body len: {}\n", .{body_len}); |
| 235 | 248 | |
| 236 | | const result_index = inst_index + body_len - 1; |
| 237 | | return walkInstruction(zir, gpa, parent_scope, types, decls, ast_nodes, result_index); |
| 249 | const break_index = inst_index + body_len; |
| 250 | const break_operand = data[break_index].@"break".operand; |
| 251 | return if (Zir.refToIndex(break_operand)) |bi| |
| 252 | walkInstruction(zir, gpa, parent_scope, types, decls, ast_nodes, bi) |
| 253 | else if (@enumToInt(break_operand) <= @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type)) |
| 254 | // we append all the types in ref first, so we can just do this if we encounter a ref that is a type |
| 255 | return DocData.WalkResult{ .type = @enumToInt(break_operand) } |
| 256 | else |
| 257 | std.debug.todo("generate WalkResults for refs that are not types"); |
| 238 | 258 | }, |
| 239 | 259 | .extended => { |
| 240 | 260 | const extended = data[inst_index].extended; |