@@ -1100,7 +1100,6 @@ function migrate_slot_usage(node, path, state) {
11001100 // if we stop the transform because the name is not correct we don't want to
11011101 // remove the let directive and they could come before the name
11021102 let removal_queue = [ ] ;
1103- let slot_name_found = false ;
11041103
11051104 for ( let attribute of node . attributes ) {
11061105 if (
@@ -1130,7 +1129,6 @@ function migrate_slot_usage(node, path, state) {
11301129 }
11311130 }
11321131 }
1133- slot_name_found = true ;
11341132 // flush the queue after we found the name
11351133 for ( let remove_let of removal_queue ) {
11361134 remove_let ( ) ;
@@ -1144,19 +1142,12 @@ function migrate_slot_usage(node, path, state) {
11441142 ? `: ${ state . str . original . substring ( /** @type {number } */ ( attribute . expression . start ) , /** @type {number } */ ( attribute . expression . end ) ) } `
11451143 : '' )
11461144 ) ;
1147- function remove_let ( ) {
1148- state . str . remove ( attribute . start , attribute . end ) ;
1149- }
1150- // if we didn't find the name yet we just add to the queue else we call immediately
1151- if ( slot_name_found ) {
1152- remove_let ( ) ;
1153- } else {
1154- removal_queue . push ( remove_let ) ;
1155- }
1145+ // we just add to the queue to remove them after we found if we need to migrate or we bail
1146+ removal_queue . push ( ( ) => state . str . remove ( attribute . start , attribute . end ) ) ;
11561147 }
11571148 }
11581149
1159- if ( ! slot_name_found && removal_queue . length > 0 ) {
1150+ if ( removal_queue . length > 0 ) {
11601151 for ( let remove_let of removal_queue ) {
11611152 remove_let ( ) ;
11621153 }
0 commit comments