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

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

Issue 85633003: Add num.parse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove inserted letter in comment. Created 7 years 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 | « no previous file | sdk/lib/core/int.dart » ('j') | sdk/lib/core/int.dart » ('J')
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 // Dart core library. 4 // Dart core library.
5 5
6 // VM implementation of double. 6 // VM implementation of double.
7 7
8 patch class double { 8 patch class double {
9 9
10 static double _native_parse(_OneByteString string) native "Double_parse"; 10 static double _native_parse(_OneByteString string) native "Double_parse";
(...skipping 27 matching lines...) Expand all
38 return _native_parse(oneByteString); 38 return _native_parse(oneByteString);
39 } 39 }
40 40
41 /* patch */ static double parse(String str, 41 /* patch */ static double parse(String str,
42 [double onError(String str)]) { 42 [double onError(String str)]) {
43 var result = _parse(str); 43 var result = _parse(str);
44 if (result == null) { 44 if (result == null) {
45 if (onError == null) throw new FormatException(str); 45 if (onError == null) throw new FormatException(str);
46 return onError(str); 46 return onError(str);
47 } 47 }
48 // Parse can create a NaN that is not identical to double.NAN.
49 if (result.isNaN) return NAN;
Lasse Reichstein Nielsen 2013/11/25 12:37:40 This seems like an unnecessary hack. The NaNs sho
floitsch 2013/11/25 12:50:53 completely agree. Please file a bug for the VM so
48 return result; 50 return result;
49 } 51 }
50 } 52 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/core/int.dart » ('j') | sdk/lib/core/int.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698