| ... | @@ -73,6 +73,9 @@ pub fn print( | ... | @@ -73,6 +73,9 @@ pub fn print( |
| 73 | const target = mod.getTarget(); | 73 | const target = mod.getTarget(); |
| 74 | var val = tv.val; | 74 | var val = tv.val; |
| 75 | var ty = tv.ty; | 75 | var ty = tv.ty; |
| | 76 | if (val.isVariable(mod)) |
| | 77 | return writer.writeAll("(variable)"); |
| | 78 | |
| 76 | while (true) switch (val.tag()) { | 79 | while (true) switch (val.tag()) { |
| 77 | .u1_type => return writer.writeAll("u1"), | 80 | .u1_type => return writer.writeAll("u1"), |
| 78 | .u8_type => return writer.writeAll("u8"), | 81 | .u8_type => return writer.writeAll("u8"), |
| ... | @@ -155,9 +158,12 @@ pub fn print( | ... | @@ -155,9 +158,12 @@ pub fn print( |
| 155 | } | 158 | } |
| 156 | try print(.{ | 159 | try print(.{ |
| 157 | .ty = ty.structFieldType(i), | 160 | .ty = ty.structFieldType(i), |
| 158 | .val = ty.structFieldValueComptime(i) orelse b: { | 161 | .val = switch (ty.containerLayout()) { |
| 159 | const vals = val.castTag(.aggregate).?.data; | 162 | .Packed => val.castTag(.aggregate).?.data[i], |
| 160 | break :b vals[i]; | 163 | else => ty.structFieldValueComptime(i) orelse b: { |
| | 164 | const vals = val.castTag(.aggregate).?.data; |
| | 165 | break :b vals[i]; |
| | 166 | }, |
| 161 | }, | 167 | }, |
| 162 | }, writer, level - 1, mod); | 168 | }, writer, level - 1, mod); |
| 163 | } | 169 | } |
| ... | @@ -241,7 +247,7 @@ pub fn print( | ... | @@ -241,7 +247,7 @@ pub fn print( |
| 241 | mod.declPtr(val.castTag(.function).?.data.owner_decl).name, | 247 | mod.declPtr(val.castTag(.function).?.data.owner_decl).name, |
| 242 | }), | 248 | }), |
| 243 | .extern_fn => return writer.writeAll("(extern function)"), | 249 | .extern_fn => return writer.writeAll("(extern function)"), |
| 244 | .variable => return writer.writeAll("(variable)"), | 250 | .variable => unreachable, |
| 245 | .decl_ref_mut => { | 251 | .decl_ref_mut => { |
| 246 | const decl_index = val.castTag(.decl_ref_mut).?.data.decl_index; | 252 | const decl_index = val.castTag(.decl_ref_mut).?.data.decl_index; |
| 247 | const decl = mod.declPtr(decl_index); | 253 | const decl = mod.declPtr(decl_index); |