| ... | ... | @@ -536,9 +536,9 @@ const DocData = struct { |
| 536 | 536 | \\ |
| 537 | 537 | , .{ v.is_allowzero, v.is_mutable, v.is_volatile, v.has_sentinel, v.has_align, v.has_addrspace, v.has_bit_range }); |
| 538 | 538 | if (options.whitespace) |ws| try ws.outputIndent(w); |
| 539 | | try w.print( |
| 540 | | \\"child": |
| 541 | | , .{}); |
| 539 | // try w.print( |
| 540 | // \\"child": |
| 541 | // , .{}); |
| 542 | 542 | |
| 543 | 543 | if (options.whitespace) |*ws| ws.indent_level += 1; |
| 544 | 544 | try v.child.jsonStringify(options, w); |
| ... | ... | @@ -924,8 +924,8 @@ fn walkInstruction( |
| 924 | 924 | }, |
| 925 | 925 | .ptr_type_simple => { |
| 926 | 926 | const ptr = data[inst_index].ptr_type_simple; |
| 927 | | const type_slot_index = self.types.items.len; |
| 928 | 927 | const elem_type_ref = try self.walkRef(file, parent_scope, ptr.elem_type, false); |
| 928 | const type_slot_index = self.types.items.len; |
| 929 | 929 | try self.types.append(self.arena, .{ |
| 930 | 930 | .Pointer = .{ .size = ptr.size, .child = elem_type_ref.expr, .is_mutable = ptr.is_mutable, .is_volatile = ptr.is_volatile, .is_allowzero = ptr.is_allowzero }, |
| 931 | 931 | }); |
| ... | ... | @@ -948,7 +948,6 @@ fn walkInstruction( |
| 948 | 948 | ); |
| 949 | 949 | |
| 950 | 950 | const sentinel: ?DocData.Expr = if (ptr.flags.has_sentinel) DocData.Expr{ .int = .{ .value = 0, .negated = false } } else null; |
| 951 | | |
| 952 | 951 | try self.types.append(self.arena, .{ |
| 953 | 952 | .Pointer = .{ .size = ptr.size, .child = elem_type_ref.expr, .sentinel = sentinel, .is_mutable = ptr.flags.is_mutable, .has_align = ptr.flags.has_align, .has_sentinel = ptr.flags.has_sentinel, .is_volatile = ptr.flags.is_volatile, .has_addrspace = ptr.flags.has_addrspace, .has_bit_range = ptr.flags.has_bit_range }, |
| 954 | 953 | }); |
| ... | ... | @@ -1021,14 +1020,11 @@ fn walkInstruction( |
| 1021 | 1020 | } |
| 1022 | 1021 | |
| 1023 | 1022 | const type_slot_index = self.types.items.len; |
| 1024 | | try self.types.append(self.arena, .{ |
| 1025 | | .Array = .{ .len = .{ |
| 1026 | | .int = .{ |
| 1027 | | .value = operands.len, |
| 1028 | | .negated = false, |
| 1029 | | }, |
| 1030 | | }, .child = array_type.? }, |
| 1031 | | }); |
| 1023 | try self.types.append(self.arena, .{ .Pointer = .{ |
| 1024 | .size = .Slice, |
| 1025 | .child = array_type.?, |
| 1026 | .is_mutable = true, |
| 1027 | } }); |
| 1032 | 1028 | |
| 1033 | 1029 | return DocData.WalkResult{ |
| 1034 | 1030 | .typeRef = .{ .type = type_slot_index }, |
| ... | ... | @@ -1061,14 +1057,7 @@ fn walkInstruction( |
| 1061 | 1057 | } |
| 1062 | 1058 | |
| 1063 | 1059 | const type_slot_index = self.types.items.len; |
| 1064 | | try self.types.append(self.arena, .{ |
| 1065 | | .Array = .{ .len = .{ |
| 1066 | | .int = .{ |
| 1067 | | .value = operands.len - 1, |
| 1068 | | .negated = false, |
| 1069 | | }, |
| 1070 | | }, .child = array_type.?, .sentinel = sentinel }, |
| 1071 | | }); |
| 1060 | try self.types.append(self.arena, .{ .Pointer = .{ .size = .Slice, .child = array_type.?, .is_mutable = true, .sentinel = sentinel } }); |
| 1072 | 1061 | |
| 1073 | 1062 | return DocData.WalkResult{ |
| 1074 | 1063 | .typeRef = .{ .type = type_slot_index }, |
| ... | ... | @@ -1180,14 +1169,7 @@ fn walkInstruction( |
| 1180 | 1169 | } |
| 1181 | 1170 | |
| 1182 | 1171 | const type_slot_index = self.types.items.len; |
| 1183 | | try self.types.append(self.arena, .{ |
| 1184 | | .Array = .{ .len = .{ |
| 1185 | | .int = .{ |
| 1186 | | .value = operands.len - 1, |
| 1187 | | .negated = false, |
| 1188 | | }, |
| 1189 | | }, .child = array_type.?, .sentinel = sentinel }, |
| 1190 | | }); |
| 1172 | try self.types.append(self.arena, .{ .Pointer = .{ .size = .Slice, .child = array_type.?, .is_mutable = true, .sentinel = sentinel } }); |
| 1191 | 1173 | |
| 1192 | 1174 | return DocData.WalkResult{ |
| 1193 | 1175 | .typeRef = .{ .type = type_slot_index }, |
| ... | ... | @@ -1198,9 +1180,7 @@ fn walkInstruction( |
| 1198 | 1180 | const pl_node = data[inst_index].pl_node; |
| 1199 | 1181 | const extra = file.zir.extraData(Zir.Inst.MultiOp, pl_node.payload_index); |
| 1200 | 1182 | const operands = file.zir.refSlice(extra.end, extra.data.operands_len); |
| 1201 | | const array_data = try self.arena.alloc(usize, operands.len - 1); |
| 1202 | | |
| 1203 | | var sentinel: ?DocData.Expr = null; |
| 1183 | const array_data = try self.arena.alloc(usize, operands.len); |
| 1204 | 1184 | |
| 1205 | 1185 | var array_type: ?DocData.Expr = null; |
| 1206 | 1186 | for (operands) |op, idx| { |
| ... | ... | @@ -1209,22 +1189,22 @@ fn walkInstruction( |
| 1209 | 1189 | array_type = wr.typeRef; |
| 1210 | 1190 | } |
| 1211 | 1191 | |
| 1212 | | if (idx == extra.data.operands_len - 1) { |
| 1213 | | sentinel = wr.expr; |
| 1214 | | const expr_index = self.exprs.items.len; |
| 1215 | | try self.exprs.append(self.arena, wr.expr); |
| 1216 | | array_data[idx] = expr_index; |
| 1217 | | } |
| 1192 | const expr_index = self.exprs.items.len; |
| 1193 | try self.exprs.append(self.arena, wr.expr); |
| 1194 | array_data[idx] = expr_index; |
| 1218 | 1195 | } |
| 1219 | 1196 | |
| 1220 | 1197 | const type_slot_index = self.types.items.len; |
| 1221 | 1198 | try self.types.append(self.arena, .{ |
| 1222 | | .Array = .{ .len = .{ |
| 1223 | | .int = .{ |
| 1224 | | .value = operands.len - 1, |
| 1225 | | .negated = false, |
| 1199 | .Array = .{ |
| 1200 | .len = .{ |
| 1201 | .int = .{ |
| 1202 | .value = operands.len - 1, |
| 1203 | .negated = false, |
| 1204 | }, |
| 1226 | 1205 | }, |
| 1227 | | }, .child = array_type.?, .sentinel = sentinel }, |
| 1206 | .child = array_type.?, |
| 1207 | }, |
| 1228 | 1208 | }); |
| 1229 | 1209 | |
| 1230 | 1210 | return DocData.WalkResult{ |
| ... | ... | @@ -1239,20 +1219,6 @@ fn walkInstruction( |
| 1239 | 1219 | .expr = .{ .float = float }, |
| 1240 | 1220 | }; |
| 1241 | 1221 | }, |
| 1242 | | .float128 => { |
| 1243 | | const pl_node = data[inst_index].pl_node; |
| 1244 | | const extra = file.zir.extraData(Zir.Inst.Float128, pl_node.payload_index); |
| 1245 | | _ = pl_node; |
| 1246 | | _ = extra; |
| 1247 | | |
| 1248 | | // printWithContext( |
| 1249 | | // file, |
| 1250 | | // inst_index, |
| 1251 | | // "TODO: implement `{s}` for walkInstruction\n\n", |
| 1252 | | // .{@tagName(tags[inst_index])}, |
| 1253 | | // ); |
| 1254 | | return self.cteTodo(@tagName(tags[inst_index])); |
| 1255 | | }, |
| 1256 | 1222 | .negate => { |
| 1257 | 1223 | const un_node = data[inst_index].un_node; |
| 1258 | 1224 | var operand: DocData.WalkResult = try self.walkRef( |
| ... | ... | @@ -2793,13 +2759,13 @@ fn analyzeFunction( |
| 2793 | 2759 | .func_extended => blk: { |
| 2794 | 2760 | const inst_data = data[inst_index].pl_node; |
| 2795 | 2761 | const extra = file.zir.extraData(Zir.Inst.ExtendedFunc, inst_data.payload_index); |
| 2796 | | |
| 2797 | 2762 | var cc_index: ?usize = null; |
| 2798 | 2763 | if (extra.data.bits.has_cc) { |
| 2799 | 2764 | const cc_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra.end]); |
| 2800 | 2765 | _ = try self.walkRef(file, scope, cc_ref, false); |
| 2801 | 2766 | cc_index = self.types.items.len - 1; |
| 2802 | 2767 | } |
| 2768 | |
| 2803 | 2769 | break :blk .{ |
| 2804 | 2770 | .Fn = .{ |
| 2805 | 2771 | .name = "todo_name func", |
| ... | ... | @@ -3043,25 +3009,21 @@ fn walkRef( |
| 3043 | 3009 | // TODO: dunno what to do with those |
| 3044 | 3010 | // .calling_convention_type => { |
| 3045 | 3011 | // return DocData.WalkResult{ |
| 3046 | | // .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, |
| 3012 | // .typeRef = .{ .type = @enumToInt(Ref.calling_convention_type) }, |
| 3047 | 3013 | // .expr = .{ .int = .{ .value = 1 } }, |
| 3048 | 3014 | // }; |
| 3049 | 3015 | // }, |
| 3050 | 3016 | // .calling_convention_c => { |
| 3051 | 3017 | // return DocData.WalkResult{ |
| 3052 | | // .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, |
| 3018 | // .typeRef = .{ .type = @enumToInt(Ref.calling_convention_c) }, |
| 3053 | 3019 | // .expr = .{ .int = .{ .value = 1 } }, |
| 3054 | 3020 | // }; |
| 3055 | 3021 | // }, |
| 3056 | 3022 | // .calling_convention_inline => { |
| 3057 | 3023 | // return DocData.WalkResult{ |
| 3058 | | // .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, |
| 3024 | // .typeRef = .{ .type = @enumToInt(Ref.calling_convention_inline) }, |
| 3059 | 3025 | // .expr = .{ .int = .{ .value = 1 } }, |
| 3060 | 3026 | // }; |
| 3061 | | // // return DocData.WalkResult{ .int = .{ |
| 3062 | | // // .type = @enumToInt(Ref.comptime_int_type), |
| 3063 | | // // .value = 1, |
| 3064 | | // // } }; |
| 3065 | 3027 | // }, |
| 3066 | 3028 | // .generic_poison => { |
| 3067 | 3029 | // return DocData.WalkResult{ .int = .{ |