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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/util/util.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 library dart2js.util; 5 library dart2js.util;
6 6
7 import "dart:collection"; 7 import "dart:collection";
8 import 'util_implementation.dart'; 8 import 'util_implementation.dart';
9 import 'characters.dart'; 9 import 'characters.dart';
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 for (int i = 0; i < string.length; i++) { 103 for (int i = 0; i < string.length; i++) {
104 int code = string.codeUnitAt(i); 104 int code = string.codeUnitAt(i);
105 if (code < 0x20 || code == $DEL || code == $DQ || code == $LS || 105 if (code < 0x20 || code == $DEL || code == $DQ || code == $LS ||
106 code == $PS || code == $BACKSLASH || code >= 0x80) { 106 code == $PS || code == $BACKSLASH || code >= 0x80) {
107 writeEscapedOn(string, buffer); 107 writeEscapedOn(string, buffer);
108 return; 108 return;
109 } 109 }
110 } 110 }
111 buffer.write(string); 111 buffer.write(string);
112 } 112 }
113
114 int computeHashCode(part1, [part2, part3, part4]) {
115 return (part1.hashCode
116 ^ part2.hashCode
117 ^ part3.hashCode
118 ^ part4.hashCode) & 0x3fffffff;
119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698