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/convert/json.dart

Issue 136373002: Fix JSON encoder accepting NaN and Infinity. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « pkg/json/test/json_test.dart ('k') | tests/corelib/json_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/convert/json.dart
diff --git a/sdk/lib/convert/json.dart b/sdk/lib/convert/json.dart
index efac7acb035435da2f010fbd9cabf975022c04f7..16001e69d0b798a0135691ce468167ce02fae08b 100644
--- a/sdk/lib/convert/json.dart
+++ b/sdk/lib/convert/json.dart
@@ -426,7 +426,7 @@ class _JsonStringifier {
*/
bool stringifyJsonValue(final object) {
if (object is num) {
- // TODO: use writeOn.
+ if (!object.isFinite) return false;
sink.write(numberToString(object));
return true;
} else if (identical(object, true)) {
@@ -449,7 +449,6 @@ class _JsonStringifier {
sink.write('[');
if (a.length > 0) {
stringifyValue(a[0]);
- // TODO: switch to Iterables.
for (int i = 1; i < a.length; i++) {
sink.write(',');
stringifyValue(a[i]);
« no previous file with comments | « pkg/json/test/json_test.dart ('k') | tests/corelib/json_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698