| ... | @@ -124,11 +124,17 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value, | ... | @@ -124,11 +124,17 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value, |
| 124 | .ifequal => { | 124 | .ifequal => { |
| 125 | comptime assertEqual(v.args.len, 2); | 125 | comptime assertEqual(v.args.len, 2); |
| 126 | const y = if (comptime std.mem.eql(u8, v.args[1][0], "this")) search(v.args[1][1..], data) else search(v.args[1], ctx); | 126 | const y = if (comptime std.mem.eql(u8, v.args[1][0], "this")) search(v.args[1][1..], data) else search(v.args[1], ctx); |
| | 127 | if (@typeInfo(@TypeOf(x)) == .Enum and comptime std.meta.trait.isZigString(@TypeOf(y))) { |
| | 128 | return try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, std.mem.eql(u8, @tagName(x), y)); |
| | 129 | } |
| 127 | try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x == y); | 130 | try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x == y); |
| 128 | }, | 131 | }, |
| 129 | .ifnotequal => { | 132 | .ifnotequal => { |
| 130 | comptime assertEqual(v.args.len, 2); | 133 | comptime assertEqual(v.args.len, 2); |
| 131 | const y = if (comptime std.mem.eql(u8, v.args[1][0], "this")) search(v.args[1][1..], data) else search(v.args[1], ctx); | 134 | const y = if (comptime std.mem.eql(u8, v.args[1][0], "this")) search(v.args[1][1..], data) else search(v.args[1], ctx); |
| | 135 | if (@typeInfo(@TypeOf(x)) == .Enum and comptime std.meta.trait.isZigString(@TypeOf(y))) { |
| | 136 | return try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, std.mem.eql(u8, @tagName(x), y)); |
| | 137 | } |
| 132 | try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x != y); | 138 | try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x != y); |
| 133 | }, | 139 | }, |
| 134 | } | 140 | } |