Skip to content

Commit e707e51

Browse files
committed
-
1 parent a263457 commit e707e51

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/build/patches.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ function handleMixin(node: Node, mixins: Record<string, any>) {
7272
const property: Properties = {};
7373

7474
for (const child of node.children) {
75-
const name = child.values[0] as string;
7675
switch (child.name) {
7776
case "event":
78-
handleEvent(child, event, name);
77+
event.push(handleEvent(child));
7978
break;
80-
case "property":
81-
handleProperty(child, property, name);
79+
case "property": {
80+
const propName = child.values[0] as string;
81+
property[propName] = handleProperty(child);
8282
break;
83+
}
8384
default:
8485
throw new Error(`Unknown node name: ${child.name}`);
8586
}
@@ -91,23 +92,21 @@ function handleMixin(node: Node, mixins: Record<string, any>) {
9192
/**
9293
* Handles a child node of type "event" and adds it to the event array.
9394
* @param child The child node to handle.
94-
* @param event The event array to update.
9595
*/
96-
function handleEvent(child: Node, event: Event[], name: string) {
97-
event.push({
98-
name,
96+
function handleEvent(child: Node) {
97+
return {
98+
name: child.values[0] as string,
9999
type: child.properties.type as string,
100-
});
100+
};
101101
}
102102

103103
/**
104104
* Handles a child node of type "property" and adds it to the property object.
105105
* @param child The child node to handle.
106-
* @param property The property object to update.
107106
*/
108-
function handleProperty(child: Node, property: Properties, name: string) {
109-
property[name] = {
110-
name,
107+
function handleProperty(child: Node) {
108+
return {
109+
name: child.values[0] as string,
111110
exposed: child.properties?.exposed as string,
112111
};
113112
}

0 commit comments

Comments
 (0)