authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-28 23:14:45 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-28 23:14:45 -07:00
log168f3420e9b12e7b48af9e859f6c7c2df23eb81d
tree548bc197f448a444cb0fa28befb00ed205e731a4
parent562cb52dc2a31bfa9859201aa5d73b5d835bf949

support comparing slices in ifequal and ifnotequal


1 files changed, 6 insertions(+), 0 deletions(-)

src/lib.zig+6
......@@ -170,6 +170,9 @@ inline fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.V
170170 if (@typeInfo(@TypeOf(x)) == .Enum and comptime std.meta.trait.isZigString(@TypeOf(y))) {
171171 return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, @tagName(x), y));
172172 }
173 if (comptime std.meta.trait.isSlice(@TypeOf(x, y))) {
174 return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, x, y));
175 }
173176 try doif(alloc, writer, body, bottom, data, ctx, opts, x == y);
174177 },
175178 .ifnotequal => {
......@@ -178,6 +181,9 @@ inline fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.V
178181 if (@typeInfo(@TypeOf(x)) == .Enum and comptime std.meta.trait.isZigString(@TypeOf(y))) {
179182 return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, @tagName(x), y));
180183 }
184 if (comptime std.meta.trait.isSlice(@TypeOf(x, y))) {
185 return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, x, y));
186 }
181187 try doif(alloc, writer, body, bottom, data, ctx, opts, x != y);
182188 },
183189 }