From 9ada98ca4bad7f67f8d0e6338dcd619ec9c0ddd8 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 23 Apr 2026 04:21:34 -0700 Subject: [PATCH] add a way to access the parent scope when nesting {#each} --- src/lib.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.zig b/src/lib.zig index bc14f0e2af8c40843b4a2cf8123529635c30f5fa..548855329e44a5f43a9d6210015d54e8fef80b58 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -158,8 +158,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val 1 => { for (x) |item| { if (@hasField(@TypeOf(ctx), "this")) { - // handle nested loops, should be temporary - try do(alloc, writer, body, null, extras.join(.{ extras.omit(ctx, "this"), .{ .this = item } }), opts); + try do(alloc, writer, body, null, extras.join(.{ extras.omit(ctx, "this"), .{ .@"^this" = ctx.this, .this = item } }), opts); } else { try do(alloc, writer, body, null, extras.join(.{ ctx, .{ .this = item } }), opts); } -- 2.54.0