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

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

Issue 988523002: Fix int.parse bug (dart2js version) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/int.dart
diff --git a/sdk/lib/core/int.dart b/sdk/lib/core/int.dart
index 681b8e8815a4f0f166fbc22c51cf92de08d781a9..a8f9862db5b78f12dde1aa8d25bc9c5ac03be531 100644
--- a/sdk/lib/core/int.dart
+++ b/sdk/lib/core/int.dart
@@ -277,6 +277,12 @@ abstract class int extends num {
* value is used instead. If no [onError] is provided, a [FormatException]
* is thrown.
*
+ * The [onError] handler may return `null`. This is preferable to catching
Lasse Reichstein Nielsen 2015/03/06 13:06:52 The [onError] handler can be chosen to return `nul
sra1 2015/03/06 21:38:39 Done.
+ * the [FormatException], for example:
+ *
+ * var value = int.parse(text, onError: (source) => null);
+ * if (value == null) ... handle the
+ *
* The [onError] function is only invoked if [source] is a [String]. It is
* not invoked if the [source] is, for example, `null`.
*/

Powered by Google App Engine
This is Rietveld 408576698