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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/code_buffer.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/code_buffer.dart
===================================================================
--- dart/sdk/lib/_internal/compiler/implementation/code_buffer.dart (revision 18634)
+++ dart/sdk/lib/_internal/compiler/implementation/code_buffer.dart (working copy)
@@ -20,11 +20,15 @@
return buffer.isEmpty;
}
+ CodeBuffer add(var object) {
+ write(object);
+ return this;
+ }
/**
* Converts [object] to a string and adds it to the buffer. If [object] is a
* [CodeBuffer], adds its markers to [markers].
*/
- CodeBuffer add(var object) {
+ CodeBuffer write(var object) {
if (object is CodeBuffer) {
return addBuffer(object);
}
@@ -33,6 +37,17 @@
return this;
}
+ CodeBuffer writeAll(Iterable<Object> objects) {
+ for (var object in objects) {
+ write(object);
+ }
+ return this;
+ }
+
+ CodeBuffer writeln(var object) {
+ return write(object).write("\n");
+ }
+
CodeBuffer addBuffer(CodeBuffer other) {
if (other.markers.length > 0) {
CodeBufferMarker firstMarker = other.markers[0];
@@ -46,17 +61,15 @@
lastBufferOffset = buffer.length + other.lastBufferOffset;
}
buffer.add(other.getText());
- }
-
- CodeBuffer addAll(Iterable<Object> iterable) {
- for (Object obj in iterable) {
- add(obj);
- }
return this;
}
- CodeBuffer addCharCode(int charCode) {
- return add(new String.fromCharCodes([charCode]));
+ CodeBuffer addAll(Iterable<Object> iterable) => writeAll(iterable);
+
+ CodeBuffer addCharCode(int charCode) => writeCharCode(charCode);
+
+ CodeBuffer writeCharCode(int charCode) {
+ return write(new String.fromCharCodes([charCode]));
}
CodeBuffer clear() {
« no previous file with comments | « dart/sdk/lib/_collection_dev/list.dart ('k') | dart/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698