authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-09 14:06:02 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-09 14:06:02 -07:00
log6eb6190aa5871ea60ea97946424b90f04e36d83c
treede554dabe2004f9dd8321f5f440b8c692b1155fe
parent7e545955bb4492f5beff995ff902c24cb91c7650

handle passing slices and arrays to #ifnot blocks


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

src/lib.zig+4
...@@ -184,6 +184,10 @@ inline fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.V...@@ -184,6 +184,10 @@ inline fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.V
184 return;184 return;
185 }185 }
186 comptime assertEqual(v.args.len, 1);186 comptime assertEqual(v.args.len, 1);
187 if (comptime std.meta.trait.isIndexable(T)) {
188 try doif(alloc, writer, body, bottom, data, ctx, opts, x.len == 0);
189 return;
190 }
187 switch (comptime TI) {191 switch (comptime TI) {
188 .Bool => try doif(alloc, writer, body, bottom, data, ctx, opts, !x),192 .Bool => try doif(alloc, writer, body, bottom, data, ctx, opts, !x),
189 .Optional => try docap(alloc, writer, body, bottom, data, ctx, opts, !x),193 .Optional => try docap(alloc, writer, body, bottom, data, ctx, opts, !x),