| 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<SourceLocation> sourceLocations; | 7 List<SourceLocation> sourceLocations; |
| 8 int lastBufferOffset = 0; | 8 int lastBufferOffset = 0; |
| 9 | 9 |
| 10 CodeBuffer() | 10 CodeBuffer() |
| 11 : buffer = new StringBuffer(), | 11 : buffer = new StringBuffer(), |
| 12 sourceLocations = new List<SourceLocation>(); | 12 sourceLocations = new List<SourceLocation>(); |
| 13 | 13 |
| 14 int get length() => buffer.length; | 14 int get length => buffer.length; |
| 15 | 15 |
| 16 bool isEmpty() { | 16 bool isEmpty() { |
| 17 return buffer.isEmpty(); | 17 return buffer.isEmpty(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Converts [object] to a string and adds it to the buffer. If [object] is a | 21 * Converts [object] to a string and adds it to the buffer. If [object] is a |
| 22 * [CodeBuffer], adds its source locations to [sourceLocations]. | 22 * [CodeBuffer], adds its source locations to [sourceLocations]. |
| 23 */ | 23 */ |
| 24 CodeBuffer add(var object) { | 24 CodeBuffer add(var object) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }); | 81 }); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 class SourceLocation { | 85 class SourceLocation { |
| 86 final Element element; | 86 final Element element; |
| 87 final Token token; | 87 final Token token; |
| 88 final int offsetDelta; | 88 final int offsetDelta; |
| 89 SourceLocation(this.element, this.token, this.offsetDelta); | 89 SourceLocation(this.element, this.token, this.offsetDelta); |
| 90 } | 90 } |
| OLD | NEW |