| ... | @@ -250,12 +250,19 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val | ... | @@ -250,12 +250,19 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val |
| 250 | .ifequal => { | 250 | .ifequal => { |
| 251 | comptime assertEqual(v.args.len, 2); | 251 | comptime assertEqual(v.args.len, 2); |
| 252 | const y = try resolveArg(v.args[1], alloc, data, ctx, opts); | 252 | const y = try resolveArg(v.args[1], alloc, data, ctx, opts); |
| | 253 | const Y = @TypeOf(y); |
| 253 | if (@typeInfo(@TypeOf(x)) == .@"enum" and comptime extras.isZigString(@TypeOf(y))) { | 254 | if (@typeInfo(@TypeOf(x)) == .@"enum" and comptime extras.isZigString(@TypeOf(y))) { |
| 254 | return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, @tagName(x), y)); | 255 | return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, @tagName(x), y)); |
| 255 | } | 256 | } |
| 256 | if (TI == .@"enum" and @typeInfo(@TypeOf(y)) == .int) { | 257 | if (TI == .@"enum" and @typeInfo(@TypeOf(y)) == .int) { |
| 257 | return doif(alloc, writer, body, bottom, data, ctx, opts, @intFromEnum(x) == y); | 258 | return doif(alloc, writer, body, bottom, data, ctx, opts, @intFromEnum(x) == y); |
| 258 | } | 259 | } |
| | 260 | if (TI == .@"union" and comptime extras.isZigString(Y)) { |
| | 261 | const tag = std.meta.stringToEnum(TI.@"union".tag_type.?, y) orelse { |
| | 262 | return doif(alloc, writer, body, bottom, data, ctx, opts, false); |
| | 263 | }; |
| | 264 | return doif(alloc, writer, body, bottom, data, ctx, opts, x == tag); |
| | 265 | } |
| 259 | if (comptime extras.isSlice(@TypeOf(x, y))) { | 266 | if (comptime extras.isSlice(@TypeOf(x, y))) { |
| 260 | return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, x, y)); | 267 | return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, x, y)); |
| 261 | } | 268 | } |