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

Unified Diff: runtime/lib/convert_patch.dart

Issue 385163002: Make VM JSON parser parse doubles without doing substring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix bad whitespace edit. Created 6 years, 5 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 | « no previous file | runtime/vm/bootstrap_natives.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/convert_patch.dart
diff --git a/runtime/lib/convert_patch.dart b/runtime/lib/convert_patch.dart
index d5683e11f87ee093796388d968bb3e95a2f75da4..25346bd1ef8ff7603bbf04981ed3b0feaf1b3e22 100644
--- a/runtime/lib/convert_patch.dart
+++ b/runtime/lib/convert_patch.dart
@@ -558,14 +558,14 @@ class _JsonParser {
listener.handleNumber(intSign * intValue);
return position;
}
- // Consider whether we can have an int/double.parse that works on part of
- // a string, to avoid creating the substring.
- String literal = source.substring(start, position);
// This correctly creates -0.0 for doubles.
- listener.handleNumber(double.parse(literal));
+ listener.handleNumber(_parseDouble(source, start, position));
return position;
}
+ static double _parseDouble(String source, int start, int end)
+ native "Double_parse";
+
void fail(int position, [String message]) {
if (message == null) message = "Unexpected character";
listener.fail(source, position, message);
« no previous file with comments | « no previous file | runtime/vm/bootstrap_natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698