@@ -37,7 +37,7 @@ export default class DecorationManagement {
3737 * @type {Object }
3838 * @access private
3939 */
40- this . decorationsByMarkerId = { }
40+ this . decorationsByMarkerId = new Map ( )
4141 /**
4242 * The subscriptions to the markers `did-change` event indexed using the
4343 * marker id.
@@ -187,7 +187,7 @@ export default class DecorationManagement {
187187
188188 for ( let i = 0 , len = markers . length ; i < len ; i ++ ) {
189189 const marker = markers [ i ]
190- const decorations = this . decorationsByMarkerId [ marker . id ]
190+ const decorations = this . decorationsByMarkerId . get ( marker . id )
191191
192192 if ( decorations != null ) {
193193 decorationsByMarkerId [ marker . id ] = decorations
@@ -348,7 +348,7 @@ export default class DecorationManagement {
348348 if ( this . decorationMarkerChangedSubscriptions [ id ] == null ) {
349349 this . decorationMarkerChangedSubscriptions [ id ] =
350350 marker . onDidChange ( ( event ) => {
351- const decorations = this . decorationsByMarkerId [ id ]
351+ const decorations = this . decorationsByMarkerId . get ( id )
352352 const screenRange = marker . getScreenRange ( )
353353
354354 this . invalidateDecorationForScreenRowsCache ( )
@@ -395,11 +395,11 @@ export default class DecorationManagement {
395395
396396 const decoration = new Decoration ( marker , this , decorationParams )
397397
398- if ( this . decorationsByMarkerId [ id ] == null ) {
399- this . decorationsByMarkerId [ id ] = [ ]
398+ if ( ! this . decorationsByMarkerId . has ( id ) ) {
399+ this . decorationsByMarkerId . set ( id , [ ] )
400400 }
401401
402- this . decorationsByMarkerId [ id ] . push ( decoration )
402+ this . decorationsByMarkerId . get ( id ) . push ( decoration )
403403 this . decorationsById . set ( decoration . id , decoration )
404404
405405 if ( this . decorationUpdatedSubscriptions [ decoration . id ] == null ) {
@@ -535,7 +535,7 @@ export default class DecorationManagement {
535535 delete this . decorationUpdatedSubscriptions [ decoration . id ]
536536 delete this . decorationDestroyedSubscriptions [ decoration . id ]
537537
538- const decorations = this . decorationsByMarkerId [ marker . id ]
538+ const decorations = this . decorationsByMarkerId . get ( marker . id )
539539 if ( ! decorations ) { return }
540540
541541 this . emitDecorationChanges ( decoration . getProperties ( ) . type , decoration )
@@ -565,7 +565,7 @@ export default class DecorationManagement {
565565 removeAllDecorationsForMarker ( marker ) {
566566 if ( marker == null ) { return }
567567
568- const decorations = this . decorationsByMarkerId [ marker . id ]
568+ const decorations = this . decorationsByMarkerId . get ( marker . id )
569569 if ( ! decorations ) { return }
570570
571571 for ( let i = 0 , len = decorations . length ; i < len ; i ++ ) {
@@ -595,7 +595,7 @@ export default class DecorationManagement {
595595 this . decorationMarkerChangedSubscriptions [ marker . id ] . dispose ( )
596596 this . decorationMarkerDestroyedSubscriptions [ marker . id ] . dispose ( )
597597
598- delete this . decorationsByMarkerId [ marker . id ]
598+ this . decorationsByMarkerId . delete ( marker . id )
599599 delete this . decorationMarkerChangedSubscriptions [ marker . id ]
600600 delete this . decorationMarkerDestroyedSubscriptions [ marker . id ]
601601 }
@@ -626,7 +626,7 @@ export default class DecorationManagement {
626626 }
627627
628628 this . decorationsById . clear ( )
629- this . decorationsByMarkerId = { }
629+ this . decorationsByMarkerId . clear ( )
630630 this . decorationMarkerChangedSubscriptions = { }
631631 this . decorationMarkerDestroyedSubscriptions = { }
632632 this . decorationUpdatedSubscriptions = { }
0 commit comments