@@ -72,14 +72,15 @@ function handleMixin(node: Node, mixins: Record<string, any>) {
72
72
const property : Properties = { } ;
73
73
74
74
for ( const child of node . children ) {
75
- const name = child . values [ 0 ] as string ;
76
75
switch ( child . name ) {
77
76
case "event" :
78
- handleEvent ( child , event , name ) ;
77
+ event . push ( handleEvent ( child ) ) ;
79
78
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 ) ;
82
82
break ;
83
+ }
83
84
default :
84
85
throw new Error ( `Unknown node name: ${ child . name } ` ) ;
85
86
}
@@ -91,23 +92,21 @@ function handleMixin(node: Node, mixins: Record<string, any>) {
91
92
/**
92
93
* Handles a child node of type "event" and adds it to the event array.
93
94
* @param child The child node to handle.
94
- * @param event The event array to update.
95
95
*/
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 ,
99
99
type : child . properties . type as string ,
100
- } ) ;
100
+ } ;
101
101
}
102
102
103
103
/**
104
104
* Handles a child node of type "property" and adds it to the property object.
105
105
* @param child The child node to handle.
106
- * @param property The property object to update.
107
106
*/
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 ,
111
110
exposed : child . properties ?. exposed as string ,
112
111
} ;
113
112
}
0 commit comments