authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-23 04:21:34 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-23 04:21:34 -07:00
log9ada98ca4bad7f67f8d0e6338dcd619ec9c0ddd8
tree286cd6b90efe9f59c7217e283dc0bfdb19e6c1a2
parent23c37ea4b36e3f7622d13d43884c3f71af411d40
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add a way to access the parent scope when nesting {#each}


1 files changed, 1 insertions(+), 2 deletions(-)

src/lib.zig+1-2
...@@ -158,8 +158,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -158,8 +158,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
158 1 => {158 1 => {
159 for (x) |item| {159 for (x) |item| {
160 if (@hasField(@TypeOf(ctx), "this")) {160 if (@hasField(@TypeOf(ctx), "this")) {
161 // handle nested loops, should be temporary161 try do(alloc, writer, body, null, extras.join(.{ extras.omit(ctx, "this"), .{ .@"^this" = ctx.this, .this = item } }), opts);
162 try do(alloc, writer, body, null, extras.join(.{ extras.omit(ctx, "this"), .{ .this = item } }), opts);
163 } else {162 } else {
164 try do(alloc, writer, body, null, extras.join(.{ ctx, .{ .this = item } }), opts);163 try do(alloc, writer, body, null, extras.join(.{ ctx, .{ .this = item } }), opts);
165 }164 }