OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.source_information; | 5 library dart2js.source_information; |
6 | 6 |
7 import '../dart2jslib.dart' show SourceSpan; | 7 import '../dart2jslib.dart' show SourceSpan; |
8 import '../elements/elements.dart' show AstElement; | 8 import '../elements/elements.dart' show AstElement; |
9 import '../scanner/scannerlib.dart' show Token; | 9 import '../scanner/scannerlib.dart' show Token; |
10 import '../tree/tree.dart' show Node; | 10 import '../tree/tree.dart' show Node; |
11 import '../js/js.dart' show JavaScriptNodeSourceInformation; | |
12 import 'code_output.dart'; | 11 import 'code_output.dart'; |
13 import 'source_file.dart'; | 12 import 'source_file.dart'; |
14 | 13 |
15 /// Interface for passing source information, for instance for use in source | 14 /// Interface for passing source information, for instance for use in source |
16 /// maps, through the backend. | 15 /// maps, through the backend. |
17 abstract class SourceInformation extends JavaScriptNodeSourceInformation { | 16 abstract class SourceInformation { |
18 SourceSpan get sourceSpan; | 17 SourceSpan get sourceSpan; |
19 void beginMapping(CodeOutput output); | 18 void beginMapping(CodeOutput output); |
20 void endMapping(CodeOutput output); | 19 void endMapping(CodeOutput output); |
21 } | 20 } |
22 | 21 |
23 /// Source information that contains start source position and optionally an | 22 /// Source information that contains start source position and optionally an |
24 /// end source position. | 23 /// end source position. |
25 class StartEndSourceInformation implements SourceInformation { | 24 class StartEndSourceInformation implements SourceInformation { |
26 final SourceFileLocation startPosition; | 25 final SourceFileLocation startPosition; |
27 final SourceFileLocation endPosition; | 26 final SourceFileLocation endPosition; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 int get offset => token.charOffset; | 154 int get offset => token.charOffset; |
156 | 155 |
157 String getSourceName() { | 156 String getSourceName() { |
158 return name; | 157 return name; |
159 } | 158 } |
160 | 159 |
161 String toString() { | 160 String toString() { |
162 return '${super.toString()}:$name'; | 161 return '${super.toString()}:$name'; |
163 } | 162 } |
164 } | 163 } |
OLD | NEW |