| 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 library dart2js.code_output; | 5 library dart2js.code_output; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'source_information.dart'; | 9 import 'source_information.dart'; |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 /// Returns the number of characters currently write to this output. | 35 /// Returns the number of characters currently write to this output. |
| 36 int get length; | 36 int get length; |
| 37 | 37 |
| 38 /// Returns `true` if this output has been closed. | 38 /// Returns `true` if this output has been closed. |
| 39 bool get isClosed; | 39 bool get isClosed; |
| 40 | 40 |
| 41 /// Closes the output. Further writes will cause a [StateError]. | 41 /// Closes the output. Further writes will cause a [StateError]. |
| 42 void close(); | 42 void close(); |
| 43 | 43 |
| 44 /// Sets the [sourcePosition] for the code next added to this output. |
| 45 void setSourceLocation(SourceLocation sourcePosition); |
| 46 |
| 44 /// Applies [f] to every marker in this output. | 47 /// Applies [f] to every marker in this output. |
| 45 void forEachSourceLocation(void f(int targetOffset, | 48 void forEachSourceLocation(void f(int targetOffset, |
| 46 SourceLocation sourceLocation)); | 49 SourceLocation sourceLocation)); |
| 47 } | 50 } |
| 48 | 51 |
| 49 abstract class AbstractCodeOutput extends CodeOutput { | 52 abstract class AbstractCodeOutput extends CodeOutput { |
| 50 List<CodeOutputMarker> markers = new List<CodeOutputMarker>(); | 53 List<CodeOutputMarker> markers = new List<CodeOutputMarker>(); |
| 51 int lastBufferOffset = 0; | 54 int lastBufferOffset = 0; |
| 52 int mappedRangeCounter = 0; | 55 int mappedRangeCounter = 0; |
| 53 bool isClosed = false; | 56 bool isClosed = false; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 158 } |
| 156 | 159 |
| 157 void close() { | 160 void close() { |
| 158 output.close(); | 161 output.close(); |
| 159 super.close(); | 162 super.close(); |
| 160 if (_listeners != null) { | 163 if (_listeners != null) { |
| 161 _listeners.forEach((listener) => listener.onDone(length)); | 164 _listeners.forEach((listener) => listener.onDone(length)); |
| 162 } | 165 } |
| 163 } | 166 } |
| 164 } | 167 } |
| OLD | NEW |