File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -223,22 +223,25 @@ namespace ts {
223
223
const entry = this . data [ key ] ;
224
224
delete this . data [ key ] ;
225
225
226
- // Adjust the linked list references.
227
- const previousElement = entry . previousEntry ! ;
228
- previousElement . nextEntry = entry . nextEntry ;
226
+ // Adjust the linked list references of the neighbor entries.
227
+ const previousEntry = entry . previousEntry ! ;
228
+ previousEntry . nextEntry = entry . nextEntry ;
229
+ if ( entry . nextEntry ) {
230
+ entry . nextEntry . previousEntry = previousEntry ;
231
+ }
232
+
233
+ // When the deleted entry was the last one, we need to
234
+ // adust the endElement reference.
235
+ if ( this . linkedListEnd === entry ) {
236
+ this . linkedListEnd = previousEntry ;
237
+ }
229
238
230
239
// Adjust the forward reference of the deleted element
231
240
// in case an iterator still references it.
232
241
entry . previousEntry = undefined ;
233
- entry . nextEntry = previousElement ;
242
+ entry . nextEntry = previousEntry ;
234
243
entry . skipNext = true ;
235
244
236
- // When the deleted entry was the last one, we need to
237
- // adust the endElement reference
238
- if ( this . linkedListEnd === entry ) {
239
- this . linkedListEnd = previousElement ;
240
- }
241
-
242
245
return true ;
243
246
}
244
247
return false ;
You can’t perform that action at this time.
0 commit comments