Skip to content

Commit

Permalink
update in response to std.builtin.Type field renames
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Sep 1, 2024
1 parent d034598 commit 28c14dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/vulkan/render.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const preamble =
\\ .C;
\\pub fn FlagsMixin(comptime FlagsType: type) type {
\\ return struct {
\\ pub const IntType = @typeInfo(FlagsType).Struct.backing_integer.?;
\\ pub const IntType = @typeInfo(FlagsType).@"struct".backing_integer.?;
\\ pub fn toInt(self: FlagsType) IntType {
\\ return @bitCast(self);
\\ }
Expand Down Expand Up @@ -1259,38 +1259,38 @@ fn Renderer(comptime WriterType: type) type {
\\ pub fn merge(lhs: CommandFlags, rhs: CommandFlags) CommandFlags {
\\ var result: CommandFlags = .{};
\\ @setEvalBranchQuota(10_000);
\\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| {
\\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| {
\\ @field(result, field.name) = @field(lhs, field.name) or @field(rhs, field.name);
\\ }
\\ return result;
\\ }
\\ pub fn intersect(lhs: CommandFlags, rhs: CommandFlags) CommandFlags {
\\ var result: CommandFlags = .{};
\\ @setEvalBranchQuota(10_000);
\\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| {
\\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| {
\\ @field(result, field.name) = @field(lhs, field.name) and @field(rhs, field.name);
\\ }
\\ return result;
\\ }
\\ pub fn complement(self: CommandFlags) CommandFlags {
\\ var result: CommandFlags = .{};
\\ @setEvalBranchQuota(10_000);
\\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| {
\\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| {
\\ @field(result, field.name) = !@field(self, field.name);
\\ }
\\ return result;
\\ }
\\ pub fn subtract(lhs: CommandFlags, rhs: CommandFlags) CommandFlags {
\\ var result: CommandFlags = .{};
\\ @setEvalBranchQuota(10_000);
\\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| {
\\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| {
\\ @field(result, field.name) = @field(lhs, field.name) and !@field(rhs, field.name);
\\ }
\\ return result;
\\ }
\\ pub fn contains(lhs: CommandFlags, rhs: CommandFlags) bool {
\\ @setEvalBranchQuota(10_000);
\\ inline for (@typeInfo(CommandFlags).Struct.fields) |field| {
\\ inline for (@typeInfo(CommandFlags).@"struct".fields) |field| {
\\ if (!@field(lhs, field.name) and @field(rhs, field.name)) {
\\ return false;
\\ }
Expand Down Expand Up @@ -1404,14 +1404,14 @@ fn Renderer(comptime WriterType: type) type {
\\ const Type = std.builtin.Type;
\\ const fields_len = fields_len: {{
\\ var fields_len: u32 = 0;
\\ for (@typeInfo({0s}CommandFlags).Struct.fields) |field| {{
\\ for (@typeInfo({0s}CommandFlags).@"struct".fields) |field| {{
\\ fields_len += @intCast(@intFromBool(@field(commands, field.name)));
\\ }}
\\ break :fields_len fields_len;
\\ }};
\\ var fields: [fields_len]Type.StructField = undefined;
\\ var i: usize = 0;
\\ for (@typeInfo({0s}CommandFlags).Struct.fields) |field| {{
\\ for (@typeInfo({0s}CommandFlags).@"struct".fields) |field| {{
\\ if (@field(commands, field.name)) {{
\\ const field_tag = std.enums.nameCast(std.meta.FieldEnum({0s}CommandFlags), field.name);
\\ const PfnType = {0s}CommandFlags.CmdType(field_tag);
Expand All @@ -1426,7 +1426,7 @@ fn Renderer(comptime WriterType: type) type {
\\ }}
\\ }}
\\ break :blk @Type(.{{
\\ .Struct = .{{
\\ .@"struct" = .{{
\\ .layout = .auto,
\\ .fields = &fields,
\\ .decls = &[_]std.builtin.Type.Declaration{{}},
Expand Down
4 changes: 2 additions & 2 deletions test/ref_all_decls.zig
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ comptime {

fn reallyRefAllDecls(comptime T: type) void {
switch (@typeInfo(T)) {
.Struct, .Union => {
.@"struct", .@"union" => {
reallyRefAllContainerDecls(T);
inline for (std.meta.fields(T)) |field| {
reallyRefAllDecls(field.type);
}
},
.Enum, .Opaque => {
.@"enum", .@"opaque" => {
reallyRefAllContainerDecls(T);
},
else => {},
Expand Down

0 comments on commit 28c14dc

Please sign in to comment.