| ... | ... | @@ -87,12 +87,12 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype |
| 87 | 87 | switch (v.name) { |
| 88 | 88 | .each => { |
| 89 | 89 | comptime assertEqual(v.args.len, 1); |
| 90 | | const x = search(v.args[0], data); |
| 90 | const x = if (comptime std.mem.eql(u8, v.args[0][0], "this")) search(v.args[0][1..], data) else search(v.args[0], ctx); |
| 91 | 91 | for (x) |item| try do(writer, body, item, ctx, indent, flag1); |
| 92 | 92 | }, |
| 93 | 93 | .@"if" => { |
| 94 | 94 | comptime assertEqual(v.args.len, 1); |
| 95 | | const x = search(v.args[0], data); |
| 95 | const x = if (comptime std.mem.eql(u8, v.args[0][0], "this")) search(v.args[0][1..], data) else search(v.args[0], ctx); |
| 96 | 96 | switch (@typeInfo(@TypeOf(x))) { |
| 97 | 97 | .Bool => try doif(writer, body, bottom, data, ctx, indent, flag1, x, true), |
| 98 | 98 | .Optional => try docap(writer, body, bottom, data, ctx, indent, flag1, x, true), |
| ... | ... | @@ -101,7 +101,7 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype |
| 101 | 101 | }, |
| 102 | 102 | .ifnot => { |
| 103 | 103 | comptime assertEqual(v.args.len, 1); |
| 104 | | const x = search(v.args[0], data); |
| 104 | const x = if (comptime std.mem.eql(u8, v.args[0][0], "this")) search(v.args[0][1..], data) else search(v.args[0], ctx); |
| 105 | 105 | switch (@typeInfo(@TypeOf(x))) { |
| 106 | 106 | .Bool => try doif(writer, body, bottom, data, ctx, indent, flag1, x, false), |
| 107 | 107 | .Optional => try docap(writer, body, bottom, data, ctx, indent, flag1, x, false), |
| ... | ... | @@ -110,14 +110,14 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype |
| 110 | 110 | }, |
| 111 | 111 | .ifequal => { |
| 112 | 112 | comptime assertEqual(v.args.len, 2); |
| 113 | | const x = search(v.args[0], data); |
| 113 | const x = if (comptime std.mem.eql(u8, v.args[0][0], "this")) search(v.args[0][1..], data) else search(v.args[0], ctx); |
| 114 | 114 | const y = search(v.args[1], data); |
| 115 | 115 | if (x == y) try do(writer, body, data, ctx, indent, flag1); |
| 116 | 116 | }, |
| 117 | 117 | .ifnotequal => { |
| 118 | 118 | comptime assertEqual(v.args.len, 2); |
| 119 | | const x = search(v.args[0], data); |
| 120 | | const y = search(v.args[1], data); |
| 119 | const x = if (comptime std.mem.eql(u8, v.args[0][0], "this")) search(v.args[0][1..], data) else search(v.args[0], ctx); |
| 120 | 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); |
| 121 | 121 | if (x != y) try do(writer, body, data, ctx, indent, flag1); |
| 122 | 122 | }, |
| 123 | 123 | } |