@@ -34,7 +34,7 @@ export function genCreateComponent(
34
34
const { vaporHelper } = context
35
35
36
36
const tag = genTag ( )
37
- const { root : isRoot , slots, dynamicSlots } = oper
37
+ const { root, slots, dynamicSlots } = oper
38
38
const rawProps = genRawProps ( oper . props , context )
39
39
40
40
return [
@@ -43,18 +43,14 @@ export function genCreateComponent(
43
43
...genCall (
44
44
vaporHelper ( 'createComponent' ) ,
45
45
tag ,
46
- rawProps || ( slots || dynamicSlots || isRoot ? 'null' : false ) ,
47
- slots
48
- ? genSlots ( slots , context )
49
- : dynamicSlots || isRoot
50
- ? 'null'
51
- : false ,
46
+ rawProps || ( slots || dynamicSlots || root ? 'null' : false ) ,
47
+ slots ? genSlots ( slots , context ) : dynamicSlots || root ? 'null' : false ,
52
48
dynamicSlots
53
49
? genDynamicSlots ( dynamicSlots , context )
54
- : isRoot
50
+ : root
55
51
? 'null'
56
52
: false ,
57
- isRoot && 'true' ,
53
+ root && 'true' ,
58
54
) ,
59
55
...genDirectivesForElement ( oper . id , context ) ,
60
56
]
@@ -149,12 +145,10 @@ function genModelModifiers(
149
145
}
150
146
151
147
function genSlots ( slots : ComponentSlots , context : CodegenContext ) {
152
- const slotList = Object . entries ( slots ! )
148
+ const slotList = Object . entries ( slots )
153
149
return genMulti (
154
150
slotList . length > 1 ? SEGMENTS_OBJECT_NEWLINE : SEGMENTS_OBJECT ,
155
- ...slotList . map ( ( [ name , slot ] ) => {
156
- return [ name , ': ' , ...genBlock ( slot , context ) ]
157
- } ) ,
151
+ ...slotList . map ( ( [ name , slot ] ) => [ name , ': ' , ...genBlock ( slot , context ) ] ) ,
158
152
)
159
153
}
160
154
@@ -164,13 +158,13 @@ function genDynamicSlots(
164
158
) {
165
159
const slotsExpr = genMulti (
166
160
dynamicSlots . length > 1 ? SEGMENTS_ARRAY_NEWLINE : SEGMENTS_ARRAY ,
167
- ...dynamicSlots . map ( ( { name, fn } ) => {
168
- return genMulti (
161
+ ...dynamicSlots . map ( ( { name, fn } ) =>
162
+ genMulti (
169
163
SEGMENTS_OBJECT_NEWLINE ,
170
164
[ 'name: ' , ...genExpression ( name , context ) ] ,
171
165
[ 'fn: ' , ...genBlock ( fn , context ) ] ,
172
- )
173
- } ) ,
166
+ ) ,
167
+ ) ,
174
168
)
175
169
return [ '() => ' , ...slotsExpr ]
176
170
}
0 commit comments