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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/tree/dartstring.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, 5 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 tree; 5 part of tree;
6 6
7 /** 7 /**
8 * The [DartString] type represents a Dart string value as a sequence of Unicode 8 * The [DartString] type represents a Dart string value as a sequence of Unicode
9 * Scalar Values. 9 * Scalar Values.
10 * After parsing, any valid [LiteralString] will contain a [DartString] 10 * After parsing, any valid [LiteralString] will contain a [DartString]
(...skipping 25 matching lines...) Expand all
36 DartString otherString = other; 36 DartString otherString = other;
37 if (length != otherString.length) return false; 37 if (length != otherString.length) return false;
38 Iterator it1 = iterator; 38 Iterator it1 = iterator;
39 Iterator it2 = otherString.iterator; 39 Iterator it2 = otherString.iterator;
40 while (it1.moveNext()) { 40 while (it1.moveNext()) {
41 if (!it2.moveNext()) return false; 41 if (!it2.moveNext()) return false;
42 if (it1.current != it2.current) return false; 42 if (it1.current != it2.current) return false;
43 } 43 }
44 return true; 44 return true;
45 } 45 }
46
47 int get hashCode => throw new UnsupportedError('DartString.hashCode');
48
46 String toString() => "DartString#${length}:${slowToString()}"; 49 String toString() => "DartString#${length}:${slowToString()}";
47 SourceString get source; 50 SourceString get source;
48 } 51 }
49 52
50 53
51 /** 54 /**
52 * A [DartString] where the content is represented by an actual [String]. 55 * A [DartString] where the content is represented by an actual [String].
53 */ 56 */
54 class LiteralDartString extends DartString { 57 class LiteralDartString extends DartString {
55 final String string; 58 final String string;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 229 }
227 _current = value; 230 _current = value;
228 break; 231 break;
229 default: 232 default:
230 _current = code; 233 _current = code;
231 } 234 }
232 return true; 235 return true;
233 } 236 }
234 } 237 }
235 238
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698