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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/util/link_implementation.dart

Issue 17569004: Implement hashCode on objects stored in a set or used as map keys. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with TOT Created 7 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of util_implementation; 5 part of util_implementation;
6 6
7 class LinkIterator<T> implements Iterator<T> { 7 class LinkIterator<T> implements Iterator<T> {
8 T _current; 8 T _current;
9 Link<T> _link; 9 Link<T> _link;
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 while (!myElements.isEmpty && !other.isEmpty) { 93 while (!myElements.isEmpty && !other.isEmpty) {
94 if (myElements.head != other.head) { 94 if (myElements.head != other.head) {
95 return false; 95 return false;
96 } 96 }
97 myElements = myElements.tail; 97 myElements = myElements.tail;
98 other = other.tail; 98 other = other.tail;
99 } 99 }
100 return myElements.isEmpty && other.isEmpty; 100 return myElements.isEmpty && other.isEmpty;
101 } 101 }
102 102
103 int get hashCode => throw new UnsupportedError('LinkEntry.hashCode');
104
103 int slowLength() => 1 + tail.slowLength(); 105 int slowLength() => 1 + tail.slowLength();
104 } 106 }
105 107
106 class LinkBuilderImplementation<T> implements LinkBuilder<T> { 108 class LinkBuilderImplementation<T> implements LinkBuilder<T> {
107 LinkEntry<T> head = null; 109 LinkEntry<T> head = null;
108 LinkEntry<T> lastLink = null; 110 LinkEntry<T> lastLink = null;
109 int length = 0; 111 int length = 0;
110 112
111 LinkBuilderImplementation(); 113 LinkBuilderImplementation();
112 114
(...skipping 12 matching lines...) Expand all
125 if (head == null) { 127 if (head == null) {
126 head = entry; 128 head = entry;
127 } else { 129 } else {
128 lastLink.tail = entry; 130 lastLink.tail = entry;
129 } 131 }
130 lastLink = entry; 132 lastLink = entry;
131 } 133 }
132 134
133 bool get isEmpty => length == 0; 135 bool get isEmpty => length == 0;
134 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698