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 '../common.dart'; | 7 import '../common.dart'; |
8 import '../elements/elements.dart' show AstElement, LocalElement; | 8 import '../elements/elements.dart' show AstElement, LocalElement, ResolvedAst; |
9 import '../js/js.dart' show JavaScriptNodeSourceInformation; | 9 import '../js/js.dart' show JavaScriptNodeSourceInformation; |
10 import '../tree/tree.dart' show Node; | 10 import '../tree/tree.dart' show Node; |
11 import 'source_file.dart'; | 11 import 'source_file.dart'; |
12 | 12 |
13 /// Interface for passing source information, for instance for use in source | 13 /// Interface for passing source information, for instance for use in source |
14 /// maps, through the backend. | 14 /// maps, through the backend. |
15 abstract class SourceInformation extends JavaScriptNodeSourceInformation { | 15 abstract class SourceInformation extends JavaScriptNodeSourceInformation { |
16 const SourceInformation(); | 16 const SourceInformation(); |
17 | 17 |
18 SourceSpan get sourceSpan; | 18 SourceSpan get sourceSpan; |
(...skipping 30 matching lines...) Expand all Loading... |
49 void onComplete() {} | 49 void onComplete() {} |
50 } | 50 } |
51 | 51 |
52 /// Interface for generating [SourceInformation]. | 52 /// Interface for generating [SourceInformation]. |
53 class SourceInformationBuilder { | 53 class SourceInformationBuilder { |
54 const SourceInformationBuilder(); | 54 const SourceInformationBuilder(); |
55 | 55 |
56 /// Create a [SourceInformationBuilder] for [element]. | 56 /// Create a [SourceInformationBuilder] for [element]. |
57 SourceInformationBuilder forContext(AstElement element) => this; | 57 SourceInformationBuilder forContext(AstElement element) => this; |
58 | 58 |
59 /// Generate [SourceInformation] the declaration of [element]. | 59 /// Generate [SourceInformation] the declaration of the element in |
60 SourceInformation buildDeclaration(AstElement element) => null; | 60 /// [resolvedAst]. |
| 61 SourceInformation buildDeclaration(ResolvedAst resolvedAst) => null; |
61 | 62 |
62 /// Generate [SourceInformation] for the generic [node]. | 63 /// Generate [SourceInformation] for the generic [node]. |
63 @deprecated | 64 @deprecated |
64 SourceInformation buildGeneric(Node node) => null; | 65 SourceInformation buildGeneric(Node node) => null; |
65 | 66 |
66 /// Generate [SourceInformation] for an instantiation of a class using [node] | 67 /// Generate [SourceInformation] for an instantiation of a class using [node] |
67 /// for the source position. | 68 /// for the source position. |
68 SourceInformation buildCreate(Node node) => null; | 69 SourceInformation buildCreate(Node node) => null; |
69 | 70 |
70 /// Generate [SourceInformation] for the return [node]. | 71 /// Generate [SourceInformation] for the return [node]. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return '${computeElementNameForSourceMaps(local.executableContext)}.$name'; | 237 return '${computeElementNameForSourceMaps(local.executableContext)}.$name'; |
237 } else if (element.enclosingClass != null) { | 238 } else if (element.enclosingClass != null) { |
238 if (element.enclosingClass.isClosure) { | 239 if (element.enclosingClass.isClosure) { |
239 return computeElementNameForSourceMaps(element.enclosingClass); | 240 return computeElementNameForSourceMaps(element.enclosingClass); |
240 } | 241 } |
241 return '${element.enclosingClass.name}.${element.name}'; | 242 return '${element.enclosingClass.name}.${element.name}'; |
242 } else { | 243 } else { |
243 return element.name; | 244 return element.name; |
244 } | 245 } |
245 } | 246 } |
OLD | NEW |