From 22d85a1699fa95346358cd1811cabf6adcd65279 Mon Sep 17 00:00:00 2001 From: Travis Staloch <1562827+travisstaloch@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:48:52 -0700 Subject: [PATCH] chore: update to zig version 0.14.0-dev.1398+c34cfe486 --- src/common.zig | 4 ++-- src/dom.zig | 22 +++++++++++----------- src/ondemand.zig | 24 ++++++++++++------------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/common.zig b/src/common.zig index e4a13e8..b73e75e 100644 --- a/src/common.zig +++ b/src/common.zig @@ -128,7 +128,7 @@ pub const TraitFn = fn (type) bool; pub fn isContainer(comptime T: type) bool { return switch (@typeInfo(T)) { - .Struct, .Union, .Enum, .Opaque => true, + .@"struct", .@"union", .@"enum", .@"opaque" => true, else => false, }; } @@ -139,7 +139,7 @@ pub fn hasFn(comptime name: []const u8) TraitFn { if (!comptime isContainer(T)) return false; if (!comptime @hasDecl(T, name)) return false; const DeclType = @TypeOf(@field(T, name)); - return @typeInfo(DeclType) == .Fn; + return @typeInfo(DeclType) == .@"fn"; } }; return Closure.trait; diff --git a/src/dom.zig b/src/dom.zig index d142f19..f05c072 100644 --- a/src/dom.zig +++ b/src/dom.zig @@ -1820,7 +1820,7 @@ pub const Element = struct { options: cmn.GetOptions, comptime child_info: std.builtin.Type, ) cmn.Error!void { - const Cchild = child_info.Pointer.child; + const Cchild = child_info.pointer.child; const allocator = options.allocator orelse return error.AllocatorRequired; var elems = std.ArrayList(Cchild).init(allocator); const arr = ele.get_array() catch unreachable; @@ -1849,30 +1849,30 @@ pub const Element = struct { const T = @TypeOf(out); const info = @typeInfo(T); switch (info) { - .Pointer => { + .pointer => { const C = std.meta.Child(T); if (comptime cmn.hasFn("jsonParse")(C)) return C.jsonParse(ele, out, options); const child_info = @typeInfo(C); - switch (info.Pointer.size) { + switch (info.pointer.size) { .One => { switch (child_info) { - .Int => out.* = std.math.cast(C, try if (child_info.Int.signedness == .signed) + .int => out.* = std.math.cast(C, try if (child_info.int.signedness == .signed) ele.get_int64() else ele.get_uint64()) orelse return error.Overflow, - .Float => out.* = @as(C, @floatCast(try ele.get_double())), - .Bool => out.* = try ele.get_bool(), - .Optional => out.* = if (ele.is(.NULL)) + .float => out.* = @as(C, @floatCast(try ele.get_double())), + .bool => out.* = try ele.get_bool(), + .optional => out.* = if (ele.is(.NULL)) null else blk: { var x: std.meta.Child(C) = undefined; try ele.jsonParse(&x, options); break :blk x; }, - .Array => try ele.jsonParse(@as([]std.meta.Child(C), out), options), - .Struct => { + .array => try ele.jsonParse(@as([]std.meta.Child(C), out), options), + .@"struct" => { switch (ele.tape.tape_ref_type()) { .START_OBJECT => { var obj = ele.get_object() catch unreachable; @@ -1884,8 +1884,8 @@ pub const Element = struct { else => return error.INCORRECT_TYPE, } }, - .Pointer => if (child_info.Pointer.size == .Slice) { - if (child_info.Pointer.child == u8) { + .pointer => if (child_info.pointer.size == .Slice) { + if (child_info.pointer.child == u8) { // std.debug.print("ele.tape.tape_ref_type()={}", .{ele.tape.tape_ref_type()}); switch (ele.tape.tape_ref_type()) { .STRING => out.* = try ele.get_string(), diff --git a/src/ondemand.zig b/src/ondemand.zig index 35dd785..d316dbb 100644 --- a/src/ondemand.zig +++ b/src/ondemand.zig @@ -97,26 +97,26 @@ pub const Value = struct { const T = @TypeOf(out); const info = @typeInfo(T); switch (info) { - .Pointer => { + .pointer => { const C = std.meta.Child(T); if (comptime cmn.hasFn("jsonParse")(C)) return C.jsonParse(val, out, options); const child_info = @typeInfo(C); - switch (info.Pointer.size) { + switch (info.pointer.size) { .One => { switch (child_info) { - .Int => out.* = try val.get_int(C), - .Float => out.* = @floatCast(try val.get_double()), - .Bool => out.* = try val.get_bool(), - .Optional => out.* = if (try val.is_null()) + .int => out.* = try val.get_int(C), + .float => out.* = @floatCast(try val.get_double()), + .bool => out.* = try val.get_bool(), + .optional => out.* = if (try val.is_null()) null else blk: { var x: std.meta.Child(C) = undefined; try val.jsonParse(&x, options); break :blk x; }, - .Array => { + .array => { var arr = try val.get_array(); var iter = arr.iterator(); for (out) |*out_ele| { @@ -124,8 +124,8 @@ pub const Value = struct { try arr_ele.jsonParse(out_ele, options); } }, - .Pointer => { - if (child_info.Pointer.size == .Slice) { + .pointer => { + if (child_info.pointer.size == .Slice) { if (options.allocator) |allocator| { switch (try val.get_type()) { .array => { @@ -148,7 +148,7 @@ pub const Value = struct { } else @compileError("unsupported type: " ++ @typeName(T) ++ ". expecting slice"); }, - .Struct => { + .@"struct" => { switch (try val.iter.get_type()) { .object => { var obj = try val.get_object(); @@ -156,7 +156,7 @@ pub const Value = struct { const field_info = @typeInfo(field.type); if (obj.find_field_unordered(field.name)) |obj_val_| { var obj_val = obj_val_; - if (field_info != .Pointer) + if (field_info != .pointer) try obj_val.jsonParse(&@field(out, field.name), options) else { if (options.allocator != null) @@ -1084,7 +1084,7 @@ pub const ValueIterator = struct { try vi.advance_non_root_scalar(@typeName(T), peek_len), .{}, ); - return std.math.cast(T, if (@typeInfo(T).Int.signedness == .signed) + return std.math.cast(T, if (@typeInfo(T).int.signedness == .signed) @as(i64, @bitCast(u64int)) else u64int) orelse return error.Overflow;