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

Unified Diff: pkg/pathos/lib/path.dart

Issue 12330077: Fix use of string buffer in pathos (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge master 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/pathos/lib/path.dart
diff --git a/pkg/pathos/lib/path.dart b/pkg/pathos/lib/path.dart
index 9e540b2d80fd8912178f0bee20e22e19fb605f46..639bab5e660390091e887f9d93dec91f62413128 100644
--- a/pkg/pathos/lib/path.dart
+++ b/pkg/pathos/lib/path.dart
@@ -194,11 +194,11 @@ _validateArgList(String method, List<String> args) {
// Show the arguments.
var message = new StringBuffer();
- message.add("$method(");
- message.add(args.take(numArgs)
+ message.write("$method(");
+ message.write(args.take(numArgs)
.map((arg) => arg == null ? "null" : '"$arg"')
.join(", "));
- message.add("): part ${i - 1} was null, but part $i was not.");
+ message.write("): part ${i - 1} was null, but part $i was not.");
throw new ArgumentError(message.toString());
}
}
@@ -364,16 +364,16 @@ class Builder {
for (var part in parts) {
if (this.isAbsolute(part)) {
// An absolute path discards everything before it.
- buffer.clear();
- buffer.add(part);
+ buffer = new StringBuffer();
+ buffer.write(part);
} else {
if (part.length > 0 && part[0].contains(style.separatorPattern)) {
// The part starts with a separator, so we don't need to add one.
} else if (needsSeparator) {
- buffer.add(separator);
+ buffer.write(separator);
}
- buffer.add(part);
+ buffer.write(part);
}
// Unless this part ends with a separator, we'll need to add one before
@@ -701,10 +701,10 @@ class _ParsedPath {
String toString() {
var builder = new StringBuffer();
- if (root != null) builder.add(root);
+ if (root != null) builder.write(root);
for (var i = 0; i < parts.length; i++) {
- builder.add(parts[i]);
- builder.add(separators[i]);
+ builder.write(parts[i]);
+ builder.write(separators[i]);
}
return builder.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