Chromium Code Reviews| Index: lib/coreimpl/hash_map_set.dart |
| =================================================================== |
| --- lib/coreimpl/hash_map_set.dart (revision 13856) |
| +++ lib/coreimpl/hash_map_set.dart (working copy) |
| @@ -78,7 +78,7 @@ |
| while (true) { |
| // [existingKey] can be either of type [K] or [_DeletedKeySentinel]. |
| Object existingKey = _keys[hash]; |
| - if (existingKey === null) { |
| + if (existingKey == null) { |
| // We are sure the key is not already in the set. |
| // If the current slot is empty and we didn't find any |
| // insertion slot before, return this slot. |
| @@ -88,7 +88,7 @@ |
| } else if (existingKey == key) { |
| // The key is already in the map. Return its slot. |
| return hash; |
| - } else if ((insertionIndex < 0) && (_DELETED_KEY === existingKey)) { |
| + } else if ((insertionIndex < 0) && (identical(_DELETED_KEY, existingKey))) { |
|
ahe
2012/10/22 09:05:21
_DELETED_KEY == existingKey
floitsch
2012/10/22 12:07:37
I prefer identical too.
Please make it fit on 80ch
danrubel
2012/10/22 13:35:48
Done.
|
| // The slot contains a deleted element. Because previous calls to this |
| // method may not have had this slot deleted, we must continue iterate |
| // to find if there is a slot with the given key. |
| @@ -112,7 +112,7 @@ |
| Object existingKey = _keys[hash]; |
| // If the slot does not contain anything (in particular, it does not |
| // contain a deleted key), we know the key is not in the map. |
| - if (existingKey === null) return -1; |
| + if (existingKey == null) return -1; |
| // The key is in the map, return its index. |
| if (existingKey == key) return hash; |
| // Go to the next probe. |
| @@ -158,7 +158,7 @@ |
| // [key] can be either of type [K] or [_DeletedKeySentinel]. |
| Object key = oldKeys[i]; |
| // If there is no key, we don't need to deal with the current slot. |
| - if (key === null || key === _DELETED_KEY) { |
| + if (key == null || identical(key, _DELETED_KEY)) { |
|
ahe
2012/10/22 09:05:21
DELETED_KEY == key
floitsch
2012/10/22 12:07:37
ditto.
|
| continue; |
| } |
| V value = oldValues[i]; |
| @@ -183,7 +183,7 @@ |
| void operator []=(K key, V value) { |
| _ensureCapacity(); |
| int index = _probeForAdding(key); |
| - if ((_keys[index] === null) || (_keys[index] === _DELETED_KEY)) { |
| + if ((_keys[index] == null) || (identical(_keys[index], _DELETED_KEY))) { |
|
ahe
2012/10/22 09:05:21
_DELETED_KEY == _keys[index]
floitsch
2012/10/22 12:07:37
ditto.
|
| _numberOfEntries++; |
| } |
| _keys[index] = key; |
| @@ -231,7 +231,7 @@ |
| int length = _keys.length; |
| for (int i = 0; i < length; i++) { |
| var key = _keys[i]; |
| - if ((key !== null) && (key !== _DELETED_KEY)) { |
| + if ((key != null) && (!identical(key, _DELETED_KEY))) { |
|
ahe
2012/10/22 09:05:21
_DELETED_KEY == key
floitsch
2012/10/22 12:07:37
ditto.
|
| f(key, _values[i]); |
| } |
| } |
| @@ -264,7 +264,7 @@ |
| int length = _values.length; |
| for (int i = 0; i < length; i++) { |
| var key = _keys[i]; |
| - if ((key !== null) && (key !== _DELETED_KEY)) { |
| + if ((key != null) && (!identical(key, _DELETED_KEY))) { |
|
ahe
2012/10/22 09:05:21
Ditto
floitsch
2012/10/22 12:07:37
ditto.
|
| if (_values[i] == value) return true; |
| } |
| } |
| @@ -408,7 +408,7 @@ |
| bool hasNext() { |
| if (_nextValidIndex >= _entries.length) return false; |
| - if (_entries[_nextValidIndex] === HashMapImplementation._DELETED_KEY) { |
| + if (identical(_entries[_nextValidIndex], HashMapImplementation._DELETED_KEY)) { |
|
ahe
2012/10/22 09:05:21
HashMapImplementation._DELETED_KEY == identical(_e
floitsch
2012/10/22 12:07:37
ditto. Please make it fit on 80chars.
danrubel
2012/10/22 13:35:48
Done.
|
| // This happens in case the set was modified in the meantime. |
| // A modification on the set may make this iterator misbehave, |
| // but we should never return the sentinel. |
| @@ -433,7 +433,7 @@ |
| do { |
| if (++_nextValidIndex >= length) break; |
| entry = _entries[_nextValidIndex]; |
| - } while ((entry === null) || (entry === deletedKey)); |
| + } while ((entry == null) || (identical(entry, deletedKey))); |
|
ahe
2012/10/22 09:05:21
deletedKey == entry
floitsch
2012/10/22 12:07:37
ditto.
|
| } |
| // The entries in the set. May contain null or the sentinel value. |