@@ -46,14 +46,14 @@ pub fn stringifyInner(
4646) @TypeOf (writer ).Error ! void {
4747 const T = @TypeOf (value );
4848 switch (@typeInfo (T )) {
49- .Bool ,
50- .Float ,
51- .Int ,
52- .ComptimeFloat ,
53- .ComptimeInt ,
49+ .bool ,
50+ .float ,
51+ .int ,
52+ .comptime_float ,
53+ .comptime_int ,
5454 = > try writer .print ("{}" , .{value }),
5555
56- .Pointer = > | ptr | {
56+ .pointer = > | ptr | {
5757 switch (ptr .size ) {
5858 .Slice = > {
5959 switch (ptr .child ) {
@@ -77,39 +77,39 @@ pub fn stringifyInner(
7777 else = > @compileError ("Expected a slice or single pointer. Got a many/C pointer '" ++ @typeName (T ) ++ "'" ),
7878 }
7979 },
80- .Array = > | arr | switch (arr .child ) {
80+ .array = > | arr | switch (arr .child ) {
8181 u8 = > try escapeString (writer , & value , indent_level , opts .whitespace ),
8282 else = > try stringifyArray (writer , value , indent_level , depth , opts ),
8383 },
8484
85- .Null = > try writer .writeAll ("null" ),
85+ .null = > try writer .writeAll ("null" ),
8686
87- .EnumLiteral = > try writer .print ("\" {s}\" " , .{@tagName (value )}),
87+ .enum_literal = > try writer .print ("\" {s}\" " , .{@tagName (value )}),
8888
89- .Enum = > {
89+ .@"enum" = > {
9090 if (@hasDecl (T , "ziggy_options" ) and @hasDecl (T .ziggy_options , "stringify" )) {
9191 try T .ziggy_options .stringify (value , opts , indent_level , depth , writer );
9292 } else {
9393 try writer .print ("\" {s}\" " , .{@tagName (value )});
9494 }
9595 },
9696
97- .Struct = > {
97+ .@"struct" = > {
9898 if (@hasDecl (T , "ziggy_options" ) and @hasDecl (T .ziggy_options , "stringify" )) {
9999 try T .ziggy_options .stringify (value , opts , indent_level , depth , writer );
100100 } else {
101101 try stringifyStruct (writer , value , indent_level , depth , opts );
102102 }
103103 },
104- .Union = > {
104+ .@"union" = > {
105105 if (@hasDecl (T , "ziggy_options" ) and @hasDecl (T .ziggy_options , "stringify" )) {
106106 try T .ziggy_options .stringify (value , opts , indent_level , depth , writer );
107107 } else {
108108 try stringifyUnion (writer , value , indent_level , depth , opts );
109109 }
110110 },
111111
112- .Optional = > {
112+ .optional = > {
113113 if (value ) | v | {
114114 try stringifyInner (v , opts , indent_level , depth , writer );
115115 } else {
@@ -177,13 +177,13 @@ fn stringifyStruct(writer: anytype, strct: anytype, indent_level: usize, depth:
177177}
178178
179179fn stringifyStructInner (writer : anytype , strct : anytype , indent_level : usize , depth : usize , opts : StringifyOptions ) ! bool {
180- const T = @typeInfo (@TypeOf (strct )).Struct ;
180+ const T = @typeInfo (@TypeOf (strct )).@ "struct" ;
181181 const field_count = blk : {
182182 var c : usize = 0 ;
183183 if (opts .emit_null_fields ) break :blk T .fields .len ;
184184 inline for (T .fields ) | field | {
185185 switch (@typeInfo (field .type )) {
186- .Optional = > if (@field (strct , field .name ) != null ) {
186+ .optional = > if (@field (strct , field .name ) != null ) {
187187 c += 1 ;
188188 },
189189 else = > c += 1 ,
@@ -194,7 +194,7 @@ fn stringifyStructInner(writer: anytype, strct: anytype, indent_level: usize, de
194194 if (T .fields .len > 0 ) {
195195 blk : {
196196 switch (@typeInfo (T .fields [0 ].type )) {
197- .Optional = > if (! opts .emit_null_fields and @field (strct , T .fields [0 ].name ) == null ) break :blk ,
197+ .optional = > if (! opts .emit_null_fields and @field (strct , T .fields [0 ].name ) == null ) break :blk ,
198198 else = > {},
199199 }
200200
@@ -214,7 +214,7 @@ fn stringifyStructInner(writer: anytype, strct: anytype, indent_level: usize, de
214214 inline for (T .fields [1.. ], 2.. ) | field , idx | {
215215 const name = field .name ;
216216 const skip = switch (@typeInfo (field .type )) {
217- .Optional = > if (@field (strct , field .name ) == null ) ! opts .emit_null_fields else false ,
217+ .optional = > if (@field (strct , field .name ) == null ) ! opts .emit_null_fields else false ,
218218 else = > false ,
219219 };
220220 if (! skip ) {
@@ -236,7 +236,7 @@ fn stringifyStructInner(writer: anytype, strct: anytype, indent_level: usize, de
236236}
237237
238238fn stringifyUnion (writer : anytype , un : anytype , indent_level : usize , depth : usize , opts : StringifyOptions ) ! void {
239- const T = @typeInfo (@TypeOf (un )).Union ;
239+ const T = @typeInfo (@TypeOf (un )).@ "union" ;
240240 if (T .tag_type == null ) @compileError ("Union '" ++ @typeName (@TypeOf (un )) ++ "' must be tagged!" );
241241 var opts_ = opts ;
242242 opts_ .omit_top_level_curly = false ;
@@ -246,7 +246,7 @@ fn stringifyUnion(writer: anytype, un: anytype, indent_level: usize, depth: usiz
246246 inline for (T .fields ) | field | {
247247 if (std .mem .eql (u8 , field .name , @tagName (at ))) {
248248 switch (@typeInfo (field .type )) {
249- .Struct = > try stringifyInner (@field (un , field .name ), opts_ , indent_level , depth , writer ),
249+ .@"struct" = > try stringifyInner (@field (un , field .name ), opts_ , indent_level , depth , writer ),
250250 else = > {
251251 const value_field : std.builtin.Type.StructField = .{
252252 .name = "value" ,
@@ -255,7 +255,7 @@ fn stringifyUnion(writer: anytype, un: anytype, indent_level: usize, depth: usiz
255255 .is_comptime = false ,
256256 .alignment = @alignOf (field .type ),
257257 };
258- const St = @Type (.{ .Struct = .{
258+ const St = @Type (.{ .@ "struct" = .{
259259 .layout = .auto ,
260260 .fields = &.{value_field },
261261 .decls = &.{},
0 commit comments