@@ -137,38 +137,6 @@ function createDirectiveKey(node: VIdentifier): VDirectiveKey {
137137 return ret
138138}
139139
140- /**
141- * Do splice.
142- * @param items The array to operate.
143- * @param start The start index.
144- * @param deleteCount The count of items to delete.
145- * @param newItems The array of items to insert.
146- */
147- function splice < T > (
148- items : T [ ] ,
149- start : number ,
150- deleteCount : number ,
151- newItems : T [ ] ,
152- ) : void {
153- switch ( newItems . length ) {
154- case 0 :
155- items . splice ( start , deleteCount )
156- break
157- case 1 :
158- items . splice ( start , deleteCount , newItems [ 0 ] )
159- break
160- case 2 :
161- items . splice ( start , deleteCount , newItems [ 0 ] , newItems [ 1 ] )
162- break
163- default :
164- Array . prototype . splice . apply (
165- items ,
166- ( [ start , deleteCount ] as any [ ] ) . concat ( newItems ) ,
167- )
168- break
169- }
170- }
171-
172140interface HasRange {
173141 range : [ number , number ]
174142}
@@ -217,7 +185,7 @@ function replaceTokens(
217185
218186 const index = sortedIndexBy ( document . tokens , node , byRange0 )
219187 const count = sortedLastIndexBy ( document . tokens , node , byRange1 ) - index
220- splice ( document . tokens , index , count , newTokens )
188+ document . tokens . splice ( index , count , ... newTokens )
221189}
222190
223191/**
@@ -234,7 +202,7 @@ function insertComments(
234202 }
235203
236204 const index = sortedIndexBy ( document . comments , newComments [ 0 ] , byRange0 )
237- splice ( document . comments , index , 0 , newComments )
205+ document . comments . splice ( index , 0 , ... newComments )
238206}
239207
240208/**
0 commit comments