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

Unified Diff: sdk/lib/core/num.dart

Issue 1895473004: Make dart:core strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/num.dart
diff --git a/sdk/lib/core/num.dart b/sdk/lib/core/num.dart
index 38587b107abf2b08582079c866f1e8df940f1d2d..21f23eef18321ab7fc4b59aa397cdbb7ead0b0d6 100644
--- a/sdk/lib/core/num.dart
+++ b/sdk/lib/core/num.dart
@@ -439,14 +439,15 @@ abstract class num implements Comparable<num> {
static num parse(String input, [num onError(String input)]) {
String source = input.trim();
// TODO(lrn): Optimize to detect format and result type in one check.
- num result = int.parse(source, onError: _returnNull);
+ num result = int.parse(source, onError: _returnIntNull);
if (result != null) return result;
- result = double.parse(source, _returnNull);
+ result = double.parse(source, _returnDoubleNull);
if (result != null) return result;
if (onError == null) throw new FormatException(input);
return onError(input);
}
- /** Helper function for [parse]. */
- static _returnNull(_) => null;
+ /** Helper functions for [parse]. */
+ static int _returnIntNull(String _) => null;
+ static double _returnDoubleNull(String _) => null;
}
« no previous file with comments | « sdk/lib/core/iterable.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698