Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
| index 09e31da11d0734d44ea381e10de9c76a926089b2..9a81be32b253683e36c03cb93fec09ac654e9912 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
| @@ -244,7 +244,26 @@ patch bool identical(Object a, Object b) { |
| } |
| 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.stringConcat(_contents, str); |
|
ahe
2013/02/15 11:30:41
I think this should be called stringConcatUnchecke
floitsch
2013/02/18 14:15:40
Done.
|
| + } |
| + |
| + patch void clear() { |
| + _contents = ""; |
| } |
| + |
| + patch String toString() => _contents; |
| } |