| 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 | 8 |
| 9 StringBuffer buffer = new StringBuffer(); | 9 StringBuffer buffer = new StringBuffer(); |
| 10 List<CodeBufferMarker> markers = new List<CodeBufferMarker>(); | 10 List<CodeBufferMarker> markers = new List<CodeBufferMarker>(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 markers.add(other.markers[i]); | 67 markers.add(other.markers[i]); |
| 68 } | 68 } |
| 69 lastBufferOffset = buffer.length + other.lastBufferOffset; | 69 lastBufferOffset = buffer.length + other.lastBufferOffset; |
| 70 } | 70 } |
| 71 buffer.write(other.getText()); | 71 buffer.write(other.getText()); |
| 72 return this; | 72 return this; |
| 73 } | 73 } |
| 74 | 74 |
| 75 CodeBuffer addAll(Iterable<Object> iterable) => writeAll(iterable); | 75 CodeBuffer addAll(Iterable<Object> iterable) => writeAll(iterable); |
| 76 | 76 |
| 77 CodeBuffer addCharCode(int charCode) => writeCharCode(charCode); | |
| 78 | |
| 79 CodeBuffer writeCharCode(int charCode) { | 77 CodeBuffer writeCharCode(int charCode) { |
| 80 buffer.writeCharCode(charCode); | 78 buffer.writeCharCode(charCode); |
| 81 return this; | 79 return this; |
| 82 } | 80 } |
| 83 | 81 |
| 84 CodeBuffer clear() { | 82 CodeBuffer clear() { |
| 85 buffer = new StringBuffer(); | 83 buffer = new StringBuffer(); |
| 86 markers.clear(); | 84 markers.clear(); |
| 87 lastBufferOffset = 0; | 85 lastBufferOffset = 0; |
| 88 return this; | 86 return this; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 119 }); | 117 }); |
| 120 } | 118 } |
| 121 } | 119 } |
| 122 | 120 |
| 123 class CodeBufferMarker { | 121 class CodeBufferMarker { |
| 124 final int offsetDelta; | 122 final int offsetDelta; |
| 125 final sourcePosition; | 123 final sourcePosition; |
| 126 | 124 |
| 127 CodeBufferMarker(this.offsetDelta, this.sourcePosition); | 125 CodeBufferMarker(this.offsetDelta, this.sourcePosition); |
| 128 } | 126 } |
| OLD | NEW |