@@ -15,6 +15,7 @@ export function* generateSlotOutlet(
15
15
node : CompilerDOM . SlotOutletNode
16
16
) : Generator < Code > {
17
17
const startTagOffset = node . loc . start . offset + options . template . content . slice ( node . loc . start . offset ) . indexOf ( node . tag ) ;
18
+ const startTagEndOffset = startTagOffset + node . tag . length ;
18
19
const propsVar = ctx . getInternalVariable ( ) ;
19
20
const nameProp = node . props . find ( prop => {
20
21
if ( prop . type === CompilerDOM . NodeTypes . ATTRIBUTE ) {
@@ -30,7 +31,7 @@ export function* generateSlotOutlet(
30
31
} ) ;
31
32
32
33
if ( options . hasDefineSlots ) {
33
- yield `__VLS_normalizeSlot (` ;
34
+ yield `__VLS_asFunctionalSlot (` ;
34
35
if ( nameProp ) {
35
36
let codes : Generator < Code > | Code [ ] ;
36
37
if ( nameProp . type === CompilerDOM . NodeTypes . ATTRIBUTE && nameProp . value ) {
@@ -78,16 +79,23 @@ export function* generateSlotOutlet(
78
79
}
79
80
else {
80
81
yield * wrapWith (
81
- node . loc . start . offset ,
82
- node . loc . end . offset ,
82
+ startTagOffset ,
83
+ startTagEndOffset ,
83
84
ctx . codeFeatures . verification ,
84
- `${ options . slotsAssignName ?? '__VLS_slots' } ['default']`
85
+ `${ options . slotsAssignName ?? '__VLS_slots' } [` ,
86
+ ...wrapWith (
87
+ startTagOffset ,
88
+ startTagEndOffset ,
89
+ ctx . codeFeatures . verification ,
90
+ `'default'`
91
+ ) ,
92
+ `]`
85
93
) ;
86
94
}
87
- yield `)?. (` ;
95
+ yield `)(` ;
88
96
yield * wrapWith (
89
97
startTagOffset ,
90
- startTagOffset + node . tag . length ,
98
+ startTagEndOffset ,
91
99
ctx . codeFeatures . verification ,
92
100
`{${ newLine } ` ,
93
101
...generateElementProps (
@@ -154,7 +162,7 @@ export function* generateSlotOutlet(
154
162
else {
155
163
ctx . slots . push ( {
156
164
name : 'default' ,
157
- tagRange : [ startTagOffset , startTagOffset + node . tag . length ] ,
165
+ tagRange : [ startTagOffset , startTagEndOffset ] ,
158
166
nodeLoc : node . loc ,
159
167
propsVar,
160
168
} ) ;
0 commit comments