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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/code_buffer.dart

Issue 15263004: Adding isNotEmpty property to collection and string. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix template generation Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js; 5 part of dart2js;
6 6
7 class CodeBuffer implements StringBuffer { 7 class CodeBuffer implements StringBuffer {
8 StringBuffer buffer; 8 StringBuffer buffer;
9 List<CodeBufferMarker> markers; 9 List<CodeBufferMarker> markers;
10 int lastBufferOffset = 0; 10 int lastBufferOffset = 0;
11 int mappedRangeCounter = 0; 11 int mappedRangeCounter = 0;
12 12
13 CodeBuffer() 13 CodeBuffer()
14 : buffer = new StringBuffer(), 14 : buffer = new StringBuffer(),
15 markers = new List<CodeBufferMarker>(); 15 markers = new List<CodeBufferMarker>();
16 16
17 int get length => buffer.length; 17 int get length => buffer.length;
18 18
19 bool get isEmpty { 19 bool get isEmpty {
20 return buffer.isEmpty; 20 return buffer.isEmpty;
21 } 21 }
22 22
23 bool get isNotEmpty => !isEmpty;
24
23 CodeBuffer add(var object) { 25 CodeBuffer add(var object) {
24 write(object); 26 write(object);
25 return this; 27 return this;
26 } 28 }
27 /** 29 /**
28 * Converts [object] to a string and adds it to the buffer. If [object] is a 30 * Converts [object] to a string and adds it to the buffer. If [object] is a
29 * [CodeBuffer], adds its markers to [markers]. 31 * [CodeBuffer], adds its markers to [markers].
30 */ 32 */
31 CodeBuffer write(var object) { 33 CodeBuffer write(var object) {
32 if (object is CodeBuffer) { 34 if (object is CodeBuffer) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 }); 122 });
121 } 123 }
122 } 124 }
123 125
124 class CodeBufferMarker { 126 class CodeBufferMarker {
125 final int offsetDelta; 127 final int offsetDelta;
126 final sourcePosition; 128 final sourcePosition;
127 129
128 CodeBufferMarker(this.offsetDelta, this.sourcePosition); 130 CodeBufferMarker(this.offsetDelta, this.sourcePosition);
129 } 131 }
OLDNEW
« no previous file with comments | « sdk/lib/_collection_dev/list.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/collection_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698