| ... | @@ -101,6 +101,10 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value, | ... | @@ -101,6 +101,10 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value, |
| 101 | }, | 101 | }, |
| 102 | .@"if" => { | 102 | .@"if" => { |
| 103 | comptime assertEqual(v.args.len, 1); | 103 | comptime assertEqual(v.args.len, 1); |
| | 104 | if (comptime std.meta.trait.isIndexable(T)) { |
| | 105 | try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x.len > 0); |
| | 106 | return; |
| | 107 | } |
| 104 | switch (comptime TI) { | 108 | switch (comptime TI) { |
| 105 | .Bool => try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x), | 109 | .Bool => try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x), |
| 106 | .Optional => try docap(alloc, writer, body, bottom, data, ctx, indent, flag1, x), | 110 | .Optional => try docap(alloc, writer, body, bottom, data, ctx, indent, flag1, x), |