compiler,std: implement ZON support
This commit allows using ZON (Zig Object Notation) in a few ways. * `@import` can be used to load ZON at comptime and convert it to a normal Zig value. In this case, `@import` must have a result type. * `std.zon.parse` can be used to parse ZON at runtime, akin to the parsing logic in `std.json`. * `std.zon.stringify` can be used to convert arbitrary data structures to ZON at runtime, again akin to `std.json`.
This commit is contained in:
@@ -13776,8 +13776,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
|
||||
};
|
||||
const bit_count = extra.type.scalarBits(self);
|
||||
const val: i64 = if (bit_count <= 64)
|
||||
bigint.to(i64) catch unreachable
|
||||
else if (bigint.to(u64)) |val|
|
||||
bigint.toInt(i64) catch unreachable
|
||||
else if (bigint.toInt(u64)) |val|
|
||||
@bitCast(val)
|
||||
else |_| {
|
||||
const limbs = try record.addManyAsSlice(
|
||||
@@ -14276,9 +14276,9 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
|
||||
else => unreachable,
|
||||
},
|
||||
};
|
||||
const val: i64 = if (bigint.to(i64)) |val|
|
||||
const val: i64 = if (bigint.toInt(i64)) |val|
|
||||
val
|
||||
else |_| if (bigint.to(u64)) |val|
|
||||
else |_| if (bigint.toInt(u64)) |val|
|
||||
@bitCast(val)
|
||||
else |_| {
|
||||
const limbs_len = std.math.divCeil(u32, extra.bit_width, 64) catch unreachable;
|
||||
|
||||
Reference in New Issue
Block a user