Chromium Code Reviews| Index: lib/coreimpl/queue.dart |
| =================================================================== |
| --- lib/coreimpl/queue.dart (revision 13856) |
| +++ lib/coreimpl/queue.dart (working copy) |
| @@ -159,7 +159,7 @@ |
| } |
| bool isEmpty() { |
| - return (_sentinel._next === _sentinel); |
| + return (identical(_sentinel._next, _sentinel)); |
|
ahe
2012/10/22 09:05:21
Put _sentinel on the left to avoid using identical
floitsch
2012/10/22 12:07:37
I would prefer keeping it.
|
| } |
| void clear() { |
| @@ -169,7 +169,7 @@ |
| void forEach(void f(E element)) { |
| DoubleLinkedQueueEntry<E> entry = _sentinel._next; |
| - while (entry !== _sentinel) { |
| + while (!identical(entry, _sentinel)) { |
| DoubleLinkedQueueEntry<E> nextEntry = entry._next; |
| f(entry._element); |
| entry = nextEntry; |
| @@ -178,7 +178,7 @@ |
| void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) { |
| DoubleLinkedQueueEntry<E> entry = _sentinel._next; |
| - while (entry !== _sentinel) { |
| + while (!identical(entry, _sentinel)) { |
| DoubleLinkedQueueEntry<E> nextEntry = entry._next; |
| f(entry); |
| entry = nextEntry; |
| @@ -187,7 +187,7 @@ |
| bool every(bool f(E element)) { |
| DoubleLinkedQueueEntry<E> entry = _sentinel._next; |
| - while (entry !== _sentinel) { |
| + while (!identical(entry, _sentinel)) { |
| DoubleLinkedQueueEntry<E> nextEntry = entry._next; |
| if (!f(entry._element)) return false; |
| entry = nextEntry; |
| @@ -197,7 +197,7 @@ |
| bool some(bool f(E element)) { |
| DoubleLinkedQueueEntry<E> entry = _sentinel._next; |
| - while (entry !== _sentinel) { |
| + while (!identical(entry, _sentinel)) { |
| DoubleLinkedQueueEntry<E> nextEntry = entry._next; |
| if (f(entry._element)) return true; |
| entry = nextEntry; |
| @@ -208,7 +208,7 @@ |
| Queue map(f(E element)) { |
| Queue other = new Queue(); |
| DoubleLinkedQueueEntry<E> entry = _sentinel._next; |
| - while (entry !== _sentinel) { |
| + while (!identical(entry, _sentinel)) { |
| DoubleLinkedQueueEntry<E> nextEntry = entry._next; |
| other.addLast(f(entry._element)); |
| entry = nextEntry; |
| @@ -224,7 +224,7 @@ |
| Queue<E> filter(bool f(E element)) { |
| Queue<E> other = new Queue<E>(); |
| DoubleLinkedQueueEntry<E> entry = _sentinel._next; |
| - while (entry !== _sentinel) { |
| + while (!identical(entry, _sentinel)) { |
| DoubleLinkedQueueEntry<E> nextEntry = entry._next; |
| if (f(entry._element)) other.addLast(entry._element); |
| entry = nextEntry; |
| @@ -250,7 +250,7 @@ |
| } |
| bool hasNext() { |
| - return _currentEntry._next !== _sentinel; |
| + return !identical(_currentEntry._next, _sentinel); |
| } |
| E next() { |