fix: skip mixin definitions in codegen to prevent duplicate rendering

Mixin definitions from included files were being rendered as content.
Now generateNode explicitly skips mixin definitions (node.call=false)
while still processing expanded mixin calls.

Bump version to 0.3.12
This commit is contained in:
2026-01-30 23:14:28 +05:30
parent dd2191829d
commit 6eddcabb8c
2 changed files with 16 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
.{ .{
.name = .pugz, .name = .pugz,
.version = "0.3.11", .version = "0.3.12",
.fingerprint = 0x822db0790e17621d, // Changing this has security and trust implications. .fingerprint = 0x822db0790e17621d, // Changing this has security and trust implications.
.minimum_zig_version = "0.15.2", .minimum_zig_version = "0.15.2",
.dependencies = .{}, .dependencies = .{},

View File

@@ -190,6 +190,21 @@ pub const Codegen = struct {
.Conditional => try self.generateConditional(node), .Conditional => try self.generateConditional(node),
.Each, .EachOf => try self.generateEach(node), .Each, .EachOf => try self.generateEach(node),
.TypeHint => {}, // Skip - processed during field extraction .TypeHint => {}, // Skip - processed during field extraction
.Mixin => {
// Skip mixin definitions (call=false), only process mixin calls (call=true)
// Mixin calls should already be expanded by mixin.expandMixins()
if (!node.call) return;
// If somehow a mixin call wasn't expanded, process its children
for (node.nodes.items) |child| {
try self.generateNode(child);
}
},
.Include => {
// Process included content (children were inlined by processIncludes)
for (node.nodes.items) |child| {
try self.generateNode(child);
}
},
else => { else => {
// Unsupported nodes: skip or process children // Unsupported nodes: skip or process children
for (node.nodes.items) |child| { for (node.nodes.items) |child| {