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

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

Issue 12296011: Version 0.3.7.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698