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

Side by Side Diff: runtime/lib/double.dart

Issue 24280003: Add Object.hashCodeOf to get the default hashCode of an object. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Now top-level and called identityHashCode Created 7 years, 2 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
« no previous file with comments | « runtime/lib/bool_patch.dart ('k') | runtime/lib/identical_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class _Double implements double { 5 class _Double implements double {
6 factory _Double.fromInteger(int value) 6 factory _Double.fromInteger(int value)
7 native "Double_doubleFromInteger"; 7 native "Double_doubleFromInteger";
8 int get hashCode { 8 int get _identityHashCode {
9 if (isNaN || isInfinite) return 0; 9 if (isNaN || isInfinite) return 0;
10 return toInt(); 10 return toInt();
11 } 11 }
12 double operator +(num other) { 12 double operator +(num other) {
13 return _add(other.toDouble()); 13 return _add(other.toDouble());
14 } 14 }
15 double _add(double other) native "Double_add"; 15 double _add(double other) native "Double_add";
16 16
17 double operator -(num other) { 17 double operator -(num other) {
18 return _sub(other.toDouble()); 18 return _sub(other.toDouble());
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return EQUAL; 226 return EQUAL;
227 } 227 }
228 } else if (isNaN) { 228 } else if (isNaN) {
229 return other.isNaN ? EQUAL : GREATER; 229 return other.isNaN ? EQUAL : GREATER;
230 } else { 230 } else {
231 // Other is NaN. 231 // Other is NaN.
232 return LESS; 232 return LESS;
233 } 233 }
234 } 234 }
235 } 235 }
OLDNEW
« no previous file with comments | « runtime/lib/bool_patch.dart ('k') | runtime/lib/identical_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698