| OLD | NEW |
| 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; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 return addBuffer(object); | 33 return addBuffer(object); |
| 34 } | 34 } |
| 35 if (mappedRangeCounter == 0) setSourceLocation(null); | 35 if (mappedRangeCounter == 0) setSourceLocation(null); |
| 36 buffer.write(object); | 36 buffer.write(object); |
| 37 return this; | 37 return this; |
| 38 } | 38 } |
| 39 | 39 |
| 40 CodeBuffer writeAll(Iterable<Object> objects, [String separator = ""]) { | 40 CodeBuffer writeAll(Iterable<Object> objects, [String separator = ""]) { |
| 41 Iterator iterator = objects.iterator; | 41 Iterator iterator = objects.iterator; |
| 42 if (!iterator.moveNext()) return this; | 42 if (!iterator.moveNext()) return this; |
| 43 if (separator == "") { | 43 if (separator.isEmpty) { |
| 44 do { | 44 do { |
| 45 write(iterator.current); | 45 write(iterator.current); |
| 46 } while (iterator.moveNext()); | 46 } while (iterator.moveNext()); |
| 47 } else { | 47 } else { |
| 48 buffer.write(iterator.current); | 48 buffer.write(iterator.current); |
| 49 while (iterator.moveNext()) { | 49 while (iterator.moveNext()) { |
| 50 write(separator); | 50 write(separator); |
| 51 write(iterator.current); | 51 write(iterator.current); |
| 52 } | 52 } |
| 53 } | 53 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 }); | 120 }); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 class CodeBufferMarker { | 124 class CodeBufferMarker { |
| 125 final int offsetDelta; | 125 final int offsetDelta; |
| 126 final sourcePosition; | 126 final sourcePosition; |
| 127 | 127 |
| 128 CodeBufferMarker(this.offsetDelta, this.sourcePosition); | 128 CodeBufferMarker(this.offsetDelta, this.sourcePosition); |
| 129 } | 129 } |
| OLD | NEW |