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

Unified Diff: pkg/args/lib/src/usage.dart

Issue 12335035: Fix use of stringbuffer in pkg/args (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/args/lib/src/usage.dart
diff --git a/pkg/args/lib/src/usage.dart b/pkg/args/lib/src/usage.dart
index 72525e29f754bf61bace26351f9896dcddc16c7c..b83a2d518a7d858a9a740e9f106e123ad67bb4f5 100644
--- a/pkg/args/lib/src/usage.dart
+++ b/pkg/args/lib/src/usage.dart
@@ -170,7 +170,7 @@ class Usage {
writeLine(int column, String text) {
// Write any pending newlines.
while (newlinesNeeded > 0) {
- buffer.add('\n');
+ buffer.write('\n');
newlinesNeeded--;
}
@@ -178,19 +178,19 @@ class Usage {
// to the next line.
while (currentColumn != column) {
if (currentColumn < NUM_COLUMNS - 1) {
- buffer.add(padRight('', columnWidths[currentColumn]));
+ buffer.write(padRight('', columnWidths[currentColumn]));
} else {
- buffer.add('\n');
+ buffer.write('\n');
}
currentColumn = (currentColumn + 1) % NUM_COLUMNS;
}
if (column < columnWidths.length) {
// Fixed-size column, so pad it.
- buffer.add(padRight(text, columnWidths[column]));
+ buffer.write(padRight(text, columnWidths[column]));
} else {
// The last column, so just write it.
- buffer.add(text);
+ buffer.write(text);
}
// Advance to the next column.
@@ -210,17 +210,17 @@ class Usage {
buildAllowedList(Option option) {
var allowedBuffer = new StringBuffer();
- allowedBuffer.add('[');
+ allowedBuffer.write('[');
bool first = true;
for (var allowed in option.allowed) {
- if (!first) allowedBuffer.add(', ');
- allowedBuffer.add(allowed);
+ if (!first) allowedBuffer.write(', ');
+ allowedBuffer.write(allowed);
if (allowed == option.defaultValue) {
- allowedBuffer.add(' (default)');
+ allowedBuffer.write(' (default)');
}
first = false;
}
- allowedBuffer.add(']');
+ allowedBuffer.write(']');
return allowedBuffer.toString();
}
}
@@ -228,11 +228,11 @@ class Usage {
/** Pads [source] to [length] by adding spaces at the end. */
String padRight(String source, int length) {
final result = new StringBuffer();
- result.add(source);
+ result.write(source);
while (result.length < length) {
- result.add(' ');
+ result.write(' ');
}
return result.toString();
-}
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698