| 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 class CodeBuffer implements StringBuffer { | 5 class CodeBuffer implements StringBuffer { |
| 6 StringBuffer buffer; | 6 StringBuffer buffer; |
| 7 List<CodeBufferMarker> markers; | 7 List<CodeBufferMarker> markers; |
| 8 int lastBufferOffset = 0; | 8 int lastBufferOffset = 0; |
| 9 int mappedRangeCounter = 0; | 9 int mappedRangeCounter = 0; |
| 10 | 10 |
| 11 CodeBuffer() | 11 CodeBuffer() |
| 12 : buffer = new StringBuffer(), | 12 : buffer = new StringBuffer(), |
| 13 markers = new List<CodeBufferMarker>(); | 13 markers = new List<CodeBufferMarker>(); |
| 14 | 14 |
| 15 int get length => buffer.length; | 15 int get length => buffer.length; |
| 16 | 16 |
| 17 bool isEmpty() { | 17 bool get isEmpty { |
| 18 return buffer.isEmpty(); | 18 return buffer.isEmpty; |
| 19 } | 19 } |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Converts [object] to a string and adds it to the buffer. If [object] is a | 22 * Converts [object] to a string and adds it to the buffer. If [object] is a |
| 23 * [CodeBuffer], adds its markers to [markers]. | 23 * [CodeBuffer], adds its markers to [markers]. |
| 24 */ | 24 */ |
| 25 CodeBuffer add(var object) { | 25 CodeBuffer add(var object) { |
| 26 if (object is CodeBuffer) { | 26 if (object is CodeBuffer) { |
| 27 return addBuffer(object); | 27 return addBuffer(object); |
| 28 } | 28 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 }); | 91 }); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 class CodeBufferMarker { | 95 class CodeBufferMarker { |
| 96 final int offsetDelta; | 96 final int offsetDelta; |
| 97 final sourcePosition; | 97 final sourcePosition; |
| 98 | 98 |
| 99 CodeBufferMarker(this.offsetDelta, this.sourcePosition); | 99 CodeBufferMarker(this.offsetDelta, this.sourcePosition); |
| 100 } | 100 } |
| OLD | NEW |