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

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

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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..235a690f633163b2478dc9f5dac42d19026ccd2e 100644
--- a/sdk/lib/json/json_base.dart
+++ b/sdk/lib/json/json_base.dart
@@ -708,7 +708,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 +748,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 {

Powered by Google App Engine
This is Rietveld 408576698