Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
_DuplicateMap: make _map readonly and private
Browse files Browse the repository at this point in the history
Helps out dart2js

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153859730
  • Loading branch information
kevmoo authored and matanlurey committed Apr 21, 2017
1 parent c674665 commit ba179a1
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,14 @@ class _DuplicateItemRecordList {
}

class _DuplicateMap {
var map = new Map<dynamic, _DuplicateItemRecordList>();
final _map = new Map<dynamic, _DuplicateItemRecordList>();
void put(CollectionChangeRecord record) {
// todo(vicb) handle corner cases
var key = record.trackById;
var duplicates = this.map[key];
var duplicates = this._map[key];
if (duplicates == null) {
duplicates = new _DuplicateItemRecordList();
this.map[key] = duplicates;
this._map[key] = duplicates;
}
duplicates.add(record);
}
Expand All @@ -740,7 +740,7 @@ class _DuplicateMap {
/// then asking if we have any more `a`s needs to return the last `a` not the
/// first or second.
CollectionChangeRecord get(dynamic trackById, [num afterIndex = null]) {
var recordList = this.map[trackById];
var recordList = this._map[trackById];
return recordList == null ? null : recordList.get(trackById, afterIndex);
}

Expand All @@ -751,24 +751,24 @@ class _DuplicateMap {
var key = record.trackById;
// todo(vicb)
// assert(this.map.containsKey(key));
_DuplicateItemRecordList recordList = this.map[key];
_DuplicateItemRecordList recordList = this._map[key];
// Remove the list of duplicates when it gets empty
if (recordList.remove(record)) {
(this.map.containsKey(key) && (this.map.remove(key) != null || true));
(this._map.containsKey(key) && (this._map.remove(key) != null || true));
}
return record;
}

bool get isEmpty {
return identical(this.map.length, 0);
return identical(this._map.length, 0);
}

void clear() {
this.map.clear();
this._map.clear();
}

String toString() {
return "_DuplicateMap($map)";
return "_DuplicateMap($_map)";
}
}

Expand Down

0 comments on commit ba179a1

Please sign in to comment.