Index: runtime/lib/double_patch.dart |
diff --git a/runtime/lib/double_patch.dart b/runtime/lib/double_patch.dart |
index 5e6cc110da2e1d26248e57b5bcbe10a0c1be76ab..e56f45dc74c234ef81628d2bb72d63c120c5c409 100644 |
--- a/runtime/lib/double_patch.dart |
+++ b/runtime/lib/double_patch.dart |
@@ -6,6 +6,15 @@ |
// VM implementation of double. |
patch class double { |
- /* patch */ |
- static double parse(String string) native "Double_parse"; |
+ static double _parse(String string) native "Double_parse"; |
+ |
+ /* patch */ static double parse(String str, |
+ [double handleError(String str)]) { |
+ if (handleError == null) return _parse(str); |
+ try { |
+ return _parse(str); |
+ } on FormatException { |
+ return handleError(str); |
+ } |
+ } |
} |