aboutsummaryrefslogtreecommitdiff
path: root/src/z/Component.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 19:58:48 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 19:58:48 +0200
commit7e22857bc903f24823ae8c02affdd879714c3a26 (patch)
treead718fa5da08b132e1d6f589a4be34c34105583c /src/z/Component.zig
parentd0a2f9b05a5df95f3d2800cb899c998d3c8d5fb6 (diff)
fix component attribute linking
Diffstat (limited to 'src/z/Component.zig')
-rw-r--r--src/z/Component.zig10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/z/Component.zig b/src/z/Component.zig
index 122975f..70d6e1d 100644
--- a/src/z/Component.zig
+++ b/src/z/Component.zig
@@ -105,17 +105,19 @@ pub fn exportLinks(self: *const Self) void {
fn linkAttributes(self: *const Self, attributes: []const Attribute) []const Attribute {
var linked: []const Attribute = &.{};
- for (attributes) |*attr| {
+ for (attributes) |attr| {
if (attr.value.len > 0 and attr.value[0] == '@') {
const event_handler = @field(self.link, attr.value[1..]);
- const attribute: []const Attribute = &.{.{
+ const attribute: Attribute = .{
.name = attr.name,
.value = std.fmt.comptimePrint(
"wasm_handle_event(\"export::{s}::{s}\", event, {})",
.{ self.name, attr.value[1..], handlerNeedsEvent(event_handler) },
),
- }};
- linked = linked ++ attribute;
+ };
+ linked = linked ++ .{attribute};
+ } else {
+ linked = linked ++ .{attr};
}
}
return linked;