Skip to content

Commit

Permalink
adapt to latest zig changes
Browse files Browse the repository at this point in the history
  • Loading branch information
illfygli authored and Hejsil committed Aug 30, 2024
1 parent 70bc703 commit 2d9db15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions clap.zig
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ pub fn parseEx(
// fields to slices and return that.
var result_args = Arguments(Id, params, value_parsers, .slice){};
inline for (meta.fields(@TypeOf(arguments))) |field| {
if (@typeInfo(field.type) == .Struct and
if (@typeInfo(field.type) == .@"struct" and
@hasDecl(field.type, "toOwnedSlice"))
{
const slice = try @field(arguments, field.name).toOwnedSlice(allocator);
Expand Down Expand Up @@ -884,7 +884,7 @@ fn deinitArgs(
// If the multi value field is a struct, we know it is a list and should be deinited.
// Otherwise, it is a slice that should be freed.
switch (@typeInfo(@TypeOf(field))) {
.Struct => @field(arguments, longest.name).deinit(allocator),
.@"struct" => @field(arguments, longest.name).deinit(allocator),
else => allocator.free(@field(arguments, longest.name)),
}
}
Expand Down Expand Up @@ -937,7 +937,7 @@ fn Arguments(
i += 1;
}

return @Type(.{ .Struct = .{
return @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &fields,
.decls = &.{},
Expand Down
4 changes: 2 additions & 2 deletions clap/parsers.zig
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ test "enumeration" {
}

fn ReturnType(comptime P: type) type {
return @typeInfo(P).Fn.return_type.?;
return @typeInfo(P).@"fn".return_type.?;
}

pub fn Result(comptime P: type) type {
return @typeInfo(ReturnType(P)).ErrorUnion.payload;
return @typeInfo(ReturnType(P)).error_union.payload;
}

0 comments on commit 2d9db15

Please sign in to comment.