@@ -248,12 +248,12 @@ pub inline fn modelRejects(
248248 descendant_element .meta .categories_superset ,
249249 );
250250
251- inline for (std .meta .fields (Categories )) | f | {
252- if (@field (intersection , f . name ) and @hasField (Reasons .Categories , f . name )) {
251+ inline for (comptime std .meta .fieldNames (Categories )) | f_name | {
252+ if (@field (intersection , f_name ) and @hasField (Reasons .Categories , f_name )) {
253253 // if this is not a runtime property, report it as the reason
254- if (! @field (descendant_element .model .categories , f . name )) {
254+ if (! @field (descendant_element .model .categories , f_name )) {
255255 return .{
256- .reason = @field (descendant_element .reasons .categories , f . name ).accept ,
256+ .reason = @field (descendant_element .reasons .categories , f_name ).accept ,
257257 .span = parent_span ,
258258 };
259259 }
@@ -299,12 +299,12 @@ pub inline fn modelRejects(
299299 descendant_rt_model .categories ,
300300 );
301301
302- inline for (std .meta .fields (Categories )) | f | {
303- if (@field (intersection , f . name ) and @hasField (Reasons .Categories , f . name )) {
302+ inline for (comptime std .meta .fieldNames (Categories )) | f_name | {
303+ if (@field (intersection , f_name ) and @hasField (Reasons .Categories , f_name )) {
304304 // if this is not a runtime property, report it as the reason
305- if (! @field (descendant_element .model .categories , f . name )) {
305+ if (! @field (descendant_element .model .categories , f_name )) {
306306 return .{
307- .reason = @field (descendant_element .reasons .categories , f . name ).reject ,
307+ .reason = @field (descendant_element .reasons .categories , f_name ).reject ,
308308 .span = parent_span ,
309309 };
310310 }
@@ -717,14 +717,14 @@ const KindMap = std.StaticStringMapWithEql(
717717);
718718
719719pub const elements : KindMap = blk : {
720- const fields = std .meta .fields (Ast .Kind )[8.. ];
721- assert (std .mem .eql (u8 , fields [0 ]. name , "a" ));
720+ const field_names = std .meta .fieldNames (Ast .Kind )[8.. ];
721+ assert (std .mem .eql (u8 , field_names [0 ], "a" ));
722722
723723 const KV = struct { []const u8 , Ast .Kind };
724724 var keys : []const KV = &.{};
725- for (fields ) | f | keys = keys ++ &[_ ]KV {.{
726- f . name ,
727- @enumFromInt ( f . value ),
725+ for (field_names ) | f_name | keys = keys ++ &[_ ]KV {.{
726+ f_name ,
727+ @field ( Ast . Kind , f_name ),
728728 }};
729729
730730 break :blk .initComptime (keys );
@@ -733,15 +733,15 @@ pub const elements: KindMap = blk: {
733733pub const all_completions = blk : {
734734 var ac : std .EnumArray (Ast.Kind , Ast .Completion ) = undefined ;
735735
736- const fields = std .meta .fields (Ast .Kind )[8.. ];
737- assert (std .mem .eql (u8 , fields [0 ]. name , "a" ));
738- for (ac .values [8.. ], fields , all .values [8.. ]) | * completion , f , elem | {
736+ const field_names = std .meta .fieldNames (Ast .Kind )[8.. ];
737+ assert (std .mem .eql (u8 , field_names [0 ], "a" ));
738+ for (ac .values [8.. ], field_names , all .values [8.. ]) | * completion , f_name , elem | {
739739 completion .* = .{
740- .label = f . name ,
741- .value = if (@field (Ast .Kind , f . name ).isVoid ())
742- f . name ++ "$1>"
740+ .label = f_name ,
741+ .value = if (@field (Ast .Kind , f_name ).isVoid ())
742+ f_name ++ "$1>"
743743 else
744- f . name ++ "$1>$0</" ++ f . name ++ ">" ,
744+ f_name ++ "$1>$0</" ++ f_name ++ ">" ,
745745 .desc = elem .desc ,
746746 .kind = .element_open ,
747747 };
0 commit comments