Chromium Code Reviews| 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; |
| } |