| ... | ... | @@ -142,12 +142,10 @@ pub fn print( |
| 142 | 142 | .extern_options_type => return writer.writeAll("std.builtin.ExternOptions"), |
| 143 | 143 | .type_info_type => return writer.writeAll("std.builtin.Type"), |
| 144 | 144 | |
| 145 | | .empty_struct_value => return writer.writeAll(".{}"), |
| 146 | | .aggregate => { |
| 145 | .empty_struct_value, .aggregate => { |
| 147 | 146 | if (level == 0) { |
| 148 | 147 | return writer.writeAll(".{ ... }"); |
| 149 | 148 | } |
| 150 | | const values = val.castTag(.aggregate).?; |
| 151 | 149 | if (ty.zigTypeTag() == .Struct) { |
| 152 | 150 | try writer.writeAll(".{"); |
| 153 | 151 | const max_len = std.math.min(ty.structFieldCount(), max_aggregate_items); |
| ... | ... | @@ -161,13 +159,7 @@ pub fn print( |
| 161 | 159 | } |
| 162 | 160 | try print(.{ |
| 163 | 161 | .ty = ty.structFieldType(i), |
| 164 | | .val = switch (ty.containerLayout()) { |
| 165 | | .Packed => values.data[i], |
| 166 | | else => ty.structFieldValueComptime(i) orelse b: { |
| 167 | | const vals = values.data; |
| 168 | | break :b vals[i]; |
| 169 | | }, |
| 170 | | }, |
| 162 | .val = val.fieldValue(ty, i), |
| 171 | 163 | }, writer, level - 1, mod); |
| 172 | 164 | } |
| 173 | 165 | if (ty.structFieldCount() > max_aggregate_items) { |
| ... | ... | @@ -184,7 +176,7 @@ pub fn print( |
| 184 | 176 | |
| 185 | 177 | var i: u32 = 0; |
| 186 | 178 | while (i < max_len) : (i += 1) { |
| 187 | | buf[i] = std.math.cast(u8, values.data[i].toUnsignedInt(target)) orelse break :str; |
| 179 | buf[i] = std.math.cast(u8, val.fieldValue(ty, i).toUnsignedInt(target)) orelse break :str; |
| 188 | 180 | } |
| 189 | 181 | |
| 190 | 182 | const truncated = if (len > max_string_len) " (truncated)" else ""; |
| ... | ... | @@ -199,7 +191,7 @@ pub fn print( |
| 199 | 191 | if (i != 0) try writer.writeAll(", "); |
| 200 | 192 | try print(.{ |
| 201 | 193 | .ty = elem_ty, |
| 202 | | .val = values.data[i], |
| 194 | .val = val.fieldValue(ty, i), |
| 203 | 195 | }, writer, level - 1, mod); |
| 204 | 196 | } |
| 205 | 197 | if (len > max_aggregate_items) { |