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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/util/link.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 dart2js.util; 5 part of dart2js.util;
6 6
7 class Link<T> { 7 class Link<T> {
8 T get head => null; 8 T get head => null;
9 Link<T> get tail => null; 9 Link<T> get tail => null;
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 throw new RangeError('Index $n out of range'); 67 throw new RangeError('Index $n out of range');
68 } 68 }
69 69
70 void forEach(void f(T element)) {} 70 void forEach(void f(T element)) {}
71 71
72 bool operator ==(other) { 72 bool operator ==(other) {
73 if (other is !Link<T>) return false; 73 if (other is !Link<T>) return false;
74 return other.isEmpty; 74 return other.isEmpty;
75 } 75 }
76 76
77 int get hashCode => throw new UnsupportedError('Link.hashCode');
78
77 String toString() => "[]"; 79 String toString() => "[]";
78 80
79 get length { 81 get length {
80 throw new UnsupportedError('get:length'); 82 throw new UnsupportedError('get:length');
81 } 83 }
82 84
83 int slowLength() => 0; 85 int slowLength() => 0;
84 86
85 // TODO(ahe): Remove this method? 87 // TODO(ahe): Remove this method?
86 bool contains(T element) { 88 bool contains(T element) {
(...skipping 24 matching lines...) Expand all
111 * Prepends all elements added to the builder to [tail]. The resulting list is 113 * Prepends all elements added to the builder to [tail]. The resulting list is
112 * returned and the builder is cleared. 114 * returned and the builder is cleared.
113 */ 115 */
114 Link<T> toLink([Link<T> tail = const Link()]); 116 Link<T> toLink([Link<T> tail = const Link()]);
115 117
116 void addLast(T t); 118 void addLast(T t);
117 119
118 final int length; 120 final int length;
119 final bool isEmpty; 121 final bool isEmpty;
120 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698