aboutsummaryrefslogtreecommitdiff
path: root/src/z/Component.zig
diff options
context:
space:
mode:
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;