diff --git a/src/renderer.zig b/src/renderer.zig index 04d8dac..d60649a 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -187,7 +187,7 @@ pub const Renderer = struct { try writer.writeAll(buf.items); }, .if_block => { - const condition = self.evaluateCondition(node.@"if".?.condition) catch return false; + const condition = try self.evaluateCondition(alloc, node.@"if".?.condition); if (condition) { for (node.@"if".?.true_body) |child| { @@ -232,8 +232,10 @@ pub const Renderer = struct { try self.renderNode(alloc, nodes, child, writer, &ctx, null); } - for (node.@"for".?.empty_body) |child| { - try self.renderNode(alloc, nodes, child, writer, &ctx, null); + if (node.@"for".?.body.len == 0) { + for (node.@"for".?.empty_body) |child| { + try self.renderNode(alloc, nodes, child, writer, &ctx, null); + } } } },