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

Unified Diff: sdk/lib/core/string_buffer.dart

Issue 1085423003: Revert "dart2js implementation of StringBuffer.writeAll that optimizes better." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/_internal/compiler/js_lib/core_patch.dart ('k') | tests/corelib/string_buffer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/string_buffer.dart
diff --git a/sdk/lib/core/string_buffer.dart b/sdk/lib/core/string_buffer.dart
index 31b87801fd4de6ba386327825ef7d337cf4ced1d..e8bc72dcd434feab9d492922d4971555569a3f06 100644
--- a/sdk/lib/core/string_buffer.dart
+++ b/sdk/lib/core/string_buffer.dart
@@ -37,9 +37,26 @@ class StringBuffer implements StringSink {
/// Adds the string representation of [charCode] to the buffer.
external void writeCharCode(int charCode);
- external void writeAll(Iterable objects, [String separator = ""]);
+ void writeAll(Iterable objects, [String separator = ""]) {
+ Iterator iterator = objects.iterator;
+ if (!iterator.moveNext()) return;
+ if (separator.isEmpty) {
+ do {
+ write(iterator.current);
+ } while (iterator.moveNext());
+ } else {
+ write(iterator.current);
+ while (iterator.moveNext()) {
+ write(separator);
+ write(iterator.current);
+ }
+ }
+ }
- external void writeln([Object obj = ""]);
+ void writeln([Object obj = ""]) {
+ write(obj);
+ write("\n");
+ }
/**
* Clears the string buffer.
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/core_patch.dart ('k') | tests/corelib/string_buffer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698