Index: dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
=================================================================== |
--- dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart (revision 18634) |
+++ dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart (working copy) |
@@ -244,7 +244,26 @@ |
} |
patch class StringBuffer { |
- patch factory StringBuffer([Object content = ""]) { |
- return new JsStringBuffer(content); |
+ String _contents = ""; |
+ |
+ patch StringBuffer([Object content = ""]) { |
+ if (content is String) { |
+ _contents = content; |
+ } else { |
+ write(content); |
+ } |
} |
+ |
+ patch int get length => _contents.length; |
+ |
+ patch void write(Object obj) { |
+ String str = obj is String ? obj : "$obj"; |
+ _contents = Primitives.stringConcatUnchecked(_contents, str); |
+ } |
+ |
+ patch void clear() { |
+ _contents = ""; |
+ } |
+ |
+ patch String toString() => _contents; |
} |