Chromium Code Reviews| Index: lib/compiler/implementation/code_buffer.dart |
| diff --git a/lib/compiler/implementation/code_buffer.dart b/lib/compiler/implementation/code_buffer.dart |
| index 3c3053e429942e4cfa4f7018efbf1998d6576e7b..6a60bc2791548e09cd68e640462ace07fe440cf3 100644 |
| --- a/lib/compiler/implementation/code_buffer.dart |
| +++ b/lib/compiler/implementation/code_buffer.dart |
| @@ -6,6 +6,7 @@ class CodeBuffer implements StringBuffer { |
| StringBuffer buffer; |
| List<SourceLocation> sourceLocations; |
| int lastBufferOffset = 0; |
| + int mappedRangeCounter = 0; |
| CodeBuffer() |
| : buffer = new StringBuffer(), |
| @@ -25,6 +26,9 @@ class CodeBuffer implements StringBuffer { |
| if (object is CodeBuffer) { |
| return addBuffer(object); |
| } |
| + if (mappedRangeCounter == 0) { |
|
floitsch
2012/09/05 14:22:18
one line.
podivilov
2012/09/06 10:52:25
Done.
|
| + setSourceLocation(null, null); |
| + } |
| buffer.add(object.toString()); |
| return this; |
| } |
| @@ -67,6 +71,15 @@ class CodeBuffer implements StringBuffer { |
| return buffer.toString(); |
| } |
| + void beginMappedRange() { |
| + mappedRangeCounter += 1; |
|
floitsch
2012/09/05 14:22:18
++
podivilov
2012/09/06 10:52:25
Done.
|
| + } |
| + |
| + void endMappedRange() { |
| + assert(mappedRangeCounter > 0); |
| + mappedRangeCounter -= 1; |
|
floitsch
2012/09/05 14:22:18
--
podivilov
2012/09/06 10:52:25
Done.
|
| + } |
| + |
| void setSourceLocation(Element element, Token token) { |
| int offsetDelta = buffer.length - lastBufferOffset; |
| sourceLocations.add(new SourceLocation(element, token, offsetDelta)); |