@@ -34,7 +34,7 @@ export function genCreateComponent(
3434 const { vaporHelper } = context
3535
3636 const tag = genTag ( )
37- const { root : isRoot , slots, dynamicSlots } = oper
37+ const { root, slots, dynamicSlots } = oper
3838 const rawProps = genRawProps ( oper . props , context )
3939
4040 return [
@@ -43,18 +43,14 @@ export function genCreateComponent(
4343 ...genCall (
4444 vaporHelper ( 'createComponent' ) ,
4545 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 ,
5248 dynamicSlots
5349 ? genDynamicSlots ( dynamicSlots , context )
54- : isRoot
50+ : root
5551 ? 'null'
5652 : false ,
57- isRoot && 'true' ,
53+ root && 'true' ,
5854 ) ,
5955 ...genDirectivesForElement ( oper . id , context ) ,
6056 ]
@@ -149,12 +145,10 @@ function genModelModifiers(
149145}
150146
151147function genSlots ( slots : ComponentSlots , context : CodegenContext ) {
152- const slotList = Object . entries ( slots ! )
148+ const slotList = Object . entries ( slots )
153149 return genMulti (
154150 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 ) ] ) ,
158152 )
159153}
160154
@@ -164,13 +158,13 @@ function genDynamicSlots(
164158) {
165159 const slotsExpr = genMulti (
166160 dynamicSlots . length > 1 ? SEGMENTS_ARRAY_NEWLINE : SEGMENTS_ARRAY ,
167- ...dynamicSlots . map ( ( { name, fn } ) => {
168- return genMulti (
161+ ...dynamicSlots . map ( ( { name, fn } ) =>
162+ genMulti (
169163 SEGMENTS_OBJECT_NEWLINE ,
170164 [ 'name: ' , ...genExpression ( name , context ) ] ,
171165 [ 'fn: ' , ...genBlock ( fn , context ) ] ,
172- )
173- } ) ,
166+ ) ,
167+ ) ,
174168 )
175169 return [ '() => ' , ...slotsExpr ]
176170}
0 commit comments