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

Unified Diff: sdk/lib/json/json_base.dart

Issue 12475004: Add dart analyzer test suite 'analyze_library' that fails if we (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 years, 9 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 | « sdk/lib/crypto/crypto_utils.dart ('k') | sdk/lib/mirrors/mirrors_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/json/json_base.dart
diff --git a/sdk/lib/json/json_base.dart b/sdk/lib/json/json_base.dart
index 5432e5aa9bee90e43ae5cd46f516e3b70ae3b185..8faa30e84afde2779374edfe2002a50863928523 100644
--- a/sdk/lib/json/json_base.dart
+++ b/sdk/lib/json/json_base.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of dart.json;
+
// JSON parsing and serialization.
/**
@@ -708,7 +710,7 @@ class _JsonStringifier {
charCodes.add(charCode);
}
}
- sb.add(needsEscape ? new String.fromCharCodes(charCodes) : s);
+ sb.write(needsEscape ? new String.fromCharCodes(charCodes) : s);
}
void checkCycle(final object) {
@@ -748,54 +750,54 @@ class _JsonStringifier {
bool stringifyJsonValue(final object) {
if (object is num) {
// TODO: use writeOn.
- sb.add(numberToString(object));
+ sb.write(numberToString(object));
return true;
} else if (identical(object, true)) {
- sb.add('true');
+ sb.write('true');
return true;
} else if (identical(object, false)) {
- sb.add('false');
+ sb.write('false');
return true;
} else if (object == null) {
- sb.add('null');
+ sb.write('null');
return true;
} else if (object is String) {
- sb.add('"');
+ sb.write('"');
escape(sb, object);
- sb.add('"');
+ sb.write('"');
return true;
} else if (object is List) {
checkCycle(object);
List a = object;
- sb.add('[');
+ sb.write('[');
if (a.length > 0) {
stringifyValue(a[0]);
// TODO: switch to Iterables.
for (int i = 1; i < a.length; i++) {
- sb.add(',');
+ sb.write(',');
stringifyValue(a[i]);
}
}
- sb.add(']');
+ sb.write(']');
seen.removeLast();
return true;
} else if (object is Map) {
checkCycle(object);
Map<String, Object> m = object;
- sb.add('{');
+ sb.write('{');
bool first = true;
m.forEach((String key, Object value) {
if (!first) {
- sb.add(',"');
+ sb.write(',"');
} else {
- sb.add('"');
+ sb.write('"');
}
escape(sb, key);
- sb.add('":');
+ sb.write('":');
stringifyValue(value);
first = false;
});
- sb.add('}');
+ sb.write('}');
seen.removeLast();
return true;
} else {
« no previous file with comments | « sdk/lib/crypto/crypto_utils.dart ('k') | sdk/lib/mirrors/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698