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

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 and update Changelog. 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
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;
Leaf 2016/04/19 23:58:36 The String annotation should not be required. As
floitsch 2016/04/20 14:15:05 But that's what the input should be. So I prefer k
Leaf 2016/04/20 17:48:37 ok.
+ static double _returnDoubleNull(String _) => null;
}

Powered by Google App Engine
This is Rietveld 408576698