| ... | @@ -1174,6 +1174,10 @@ pub const Value = extern union { | ... | @@ -1174,6 +1174,10 @@ pub const Value = extern union { |
| 1174 | return; | 1174 | return; |
| 1175 | } | 1175 | } |
| 1176 | switch (ty.zigTypeTag()) { | 1176 | switch (ty.zigTypeTag()) { |
| | 1177 | .Void => {}, |
| | 1178 | .Bool => { |
| | 1179 | buffer[0] = @boolToInt(val.toBool()); |
| | 1180 | }, |
| 1177 | .Int => { | 1181 | .Int => { |
| 1178 | var bigint_buffer: BigIntSpace = undefined; | 1182 | var bigint_buffer: BigIntSpace = undefined; |
| 1179 | const bigint = val.toBigInt(&bigint_buffer, target); | 1183 | const bigint = val.toBigInt(&bigint_buffer, target); |
| ... | @@ -1291,6 +1295,14 @@ pub const Value = extern union { | ... | @@ -1291,6 +1295,14 @@ pub const Value = extern union { |
| 1291 | ) Allocator.Error!Value { | 1295 | ) Allocator.Error!Value { |
| 1292 | const target = mod.getTarget(); | 1296 | const target = mod.getTarget(); |
| 1293 | switch (ty.zigTypeTag()) { | 1297 | switch (ty.zigTypeTag()) { |
| | 1298 | .Void => return Value.@"void", |
| | 1299 | .Bool => { |
| | 1300 | if (buffer[0] == 0) { |
| | 1301 | return Value.@"false"; |
| | 1302 | } else { |
| | 1303 | return Value.@"true"; |
| | 1304 | } |
| | 1305 | }, |
| 1294 | .Int => { | 1306 | .Int => { |
| 1295 | if (buffer.len == 0) return Value.zero; | 1307 | if (buffer.len == 0) return Value.zero; |
| 1296 | const int_info = ty.intInfo(target); | 1308 | const int_info = ty.intInfo(target); |
| ... | @@ -1311,7 +1323,7 @@ pub const Value = extern union { | ... | @@ -1311,7 +1323,7 @@ pub const Value = extern union { |
| 1311 | 128 => return Value.Tag.float_128.create(arena, floatReadFromMemory(f128, target, buffer)), | 1323 | 128 => return Value.Tag.float_128.create(arena, floatReadFromMemory(f128, target, buffer)), |
| 1312 | else => unreachable, | 1324 | else => unreachable, |
| 1313 | }, | 1325 | }, |
| 1314 | .Array => { | 1326 | .Array, .Vector => { |
| 1315 | const elem_ty = ty.childType(); | 1327 | const elem_ty = ty.childType(); |
| 1316 | const elem_size = elem_ty.abiSize(target); | 1328 | const elem_size = elem_ty.abiSize(target); |
| 1317 | const elems = try arena.alloc(Value, @intCast(usize, ty.arrayLen())); | 1329 | const elems = try arena.alloc(Value, @intCast(usize, ty.arrayLen())); |