| ... | ... | @@ -45,6 +45,14 @@ ref_paths_pending_on_types: std.AutoHashMapUnmanaged( |
| 45 | 45 | std.ArrayListUnmanaged(RefPathResumeInfo), |
| 46 | 46 | ) = .{}, |
| 47 | 47 | |
| 48 | /// A set of ZIR instruction refs which have a meaning other than the |
| 49 | /// instruction they refer to. For instance, during analysis of the arguments to |
| 50 | /// a `call`, the index of the `call` itself is repurposed to refer to the |
| 51 | /// parameter type. |
| 52 | /// TODO: there should be some kind of proper handling for these instructions; |
| 53 | /// currently we just ignore them! |
| 54 | repurposed_insts: std.AutoHashMapUnmanaged(Zir.Inst.Index, void) = .{}, |
| 55 | |
| 48 | 56 | const RefPathResumeInfo = struct { |
| 49 | 57 | file: *File, |
| 50 | 58 | ref_path: []DocData.Expr, |
| ... | ... | @@ -954,6 +962,11 @@ fn walkInstruction( |
| 954 | 962 | const tags = file.zir.instructions.items(.tag); |
| 955 | 963 | const data = file.zir.instructions.items(.data); |
| 956 | 964 | |
| 965 | if (self.repurposed_insts.contains(@intCast(inst_index))) { |
| 966 | // TODO: better handling here |
| 967 | return .{ .expr = .{ .comptimeExpr = 0 } }; |
| 968 | } |
| 969 | |
| 957 | 970 | // We assume that the topmost ast_node entry corresponds to our decl |
| 958 | 971 | const self_ast_node_index = self.ast_nodes.items.len - 1; |
| 959 | 972 | |
| ... | ... | @@ -3022,6 +3035,9 @@ fn walkInstruction( |
| 3022 | 3035 | var args = try self.arena.alloc(DocData.Expr, args_len); |
| 3023 | 3036 | const body = file.zir.extra[extra.end..]; |
| 3024 | 3037 | |
| 3038 | try self.repurposed_insts.put(self.arena, @intCast(inst_index), {}); |
| 3039 | defer _ = self.repurposed_insts.remove(@intCast(inst_index)); |
| 3040 | |
| 3025 | 3041 | var i: usize = 0; |
| 3026 | 3042 | while (i < args_len) : (i += 1) { |
| 3027 | 3043 | const arg_end = file.zir.extra[extra.end + i]; |