Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1192)

Unified Diff: sdk/lib/core/map.dart

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/core/expect.dart ('k') | sdk/lib/core/options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/map.dart
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index 60db6ce71c70ec078f0fd4dcdcd2673803d0c4e4..926312fb433c094b294c9cd9b85cb016750dff61 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -198,7 +198,7 @@ class _HashMapImpl<K, V> implements HashMap<K, V> {
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.
@@ -208,7 +208,8 @@ class _HashMapImpl<K, V> implements HashMap<K, V> {
} 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(existingKey, _DELETED_KEY))) {
// 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.
@@ -232,7 +233,7 @@ class _HashMapImpl<K, V> implements HashMap<K, V> {
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.
@@ -278,7 +279,7 @@ class _HashMapImpl<K, V> implements HashMap<K, V> {
// [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)) {
continue;
}
V value = oldValues[i];
@@ -303,7 +304,7 @@ class _HashMapImpl<K, V> implements HashMap<K, V> {
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))) {
_numberOfEntries++;
}
_keys[index] = key;
@@ -351,7 +352,7 @@ class _HashMapImpl<K, V> implements HashMap<K, V> {
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))) {
f(key, _values[i]);
}
}
@@ -384,7 +385,7 @@ class _HashMapImpl<K, V> implements HashMap<K, V> {
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))) {
if (_values[i] == value) return true;
}
}
@@ -450,20 +451,20 @@ class _LinkedHashMapImpl<K, V> implements LinkedHashMap<K, V> {
V operator [](K key) {
DoubleLinkedQueueEntry<_KeyValuePair<K, V>> entry = _map[key];
- if (entry === null) return null;
+ if (entry == null) return null;
return entry.element.value;
}
V remove(K key) {
DoubleLinkedQueueEntry<_KeyValuePair<K, V>> entry = _map.remove(key);
- if (entry === null) return null;
+ if (entry == null) return null;
entry.remove();
return entry.element.value;
}
V putIfAbsent(K key, V ifAbsent()) {
V value = this[key];
- if ((this[key] === null) && !(containsKey(key))) {
+ if ((this[key] == null) && !(containsKey(key))) {
value = ifAbsent();
this[key] = value;
}
« no previous file with comments | « sdk/lib/core/expect.dart ('k') | sdk/lib/core/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698