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

Unified Diff: sdk/lib/_internal/compiler/implementation/code_buffer.dart

Issue 13008021: Add optional writeAll separator argument. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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/_internal/compiler/implementation/code_buffer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/code_buffer.dart b/sdk/lib/_internal/compiler/implementation/code_buffer.dart
index 69fab9ae5ffd0a5d63ad071257cefff44c553857..4c0a1fe18c0efddc2b4039cd84a54190af215804 100644
--- a/sdk/lib/_internal/compiler/implementation/code_buffer.dart
+++ b/sdk/lib/_internal/compiler/implementation/code_buffer.dart
@@ -37,9 +37,19 @@ class CodeBuffer implements StringBuffer {
return this;
}
- CodeBuffer writeAll(Iterable<Object> objects) {
- for (var object in objects) {
- write(object);
+ CodeBuffer writeAll(Iterable<Object> objects, [String separator = ""]) {
+ Iterator iterator = objects.iterator;
+ if (!iterator.moveNext()) return this;
+ if (separator == "") {
+ do {
+ write(iterator.current);
+ } while (iterator.moveNext());
+ } else {
+ buffer.write(iterator.current);
+ while (iterator.moveNext()) {
+ write(separator);
+ write(iterator.current);
+ }
}
return this;
}
« no previous file with comments | « pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart ('k') | sdk/lib/collection/collections.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698