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 'package:kernel/ast.dart' show Location; | 7 import 'package:kernel/ast.dart' show Location; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../elements/elements.dart' | 9 import '../elements/elements.dart' |
10 show | 10 show |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 /// Return a short textual representation of the source location. | 41 /// Return a short textual representation of the source location. |
42 String get shortText; | 42 String get shortText; |
43 } | 43 } |
44 | 44 |
45 /// Strategy for creating, processing and applying [SourceInformation]. | 45 /// Strategy for creating, processing and applying [SourceInformation]. |
46 class SourceInformationStrategy { | 46 class SourceInformationStrategy { |
47 const SourceInformationStrategy(); | 47 const SourceInformationStrategy(); |
48 | 48 |
49 /// Create a [SourceInformationBuilder] for [member]. | 49 /// Create a [SourceInformationBuilder] for [member]. |
50 SourceInformationBuilder createBuilderForContext(MemberEntity member) { | 50 SourceInformationBuilder createBuilderForContext( |
| 51 covariant MemberEntity member) { |
51 return const SourceInformationBuilder(); | 52 return const SourceInformationBuilder(); |
52 } | 53 } |
53 | 54 |
54 /// Generate [SourceInformation] marker for non-preamble code. | 55 /// Generate [SourceInformation] marker for non-preamble code. |
55 SourceInformation buildSourceMappedMarker() => null; | 56 SourceInformation buildSourceMappedMarker() => null; |
56 | 57 |
57 /// Called when compilation has completed. | 58 /// Called when compilation has completed. |
58 void onComplete() {} | 59 void onComplete() {} |
59 } | 60 } |
60 | 61 |
61 /// Interface for generating [SourceInformation]. | 62 /// Interface for generating [SourceInformation]. |
62 class SourceInformationBuilder { | 63 class SourceInformationBuilder { |
63 const SourceInformationBuilder(); | 64 const SourceInformationBuilder(); |
64 | 65 |
65 /// Create a [SourceInformationBuilder] for [member]. | 66 /// Create a [SourceInformationBuilder] for [member]. |
66 SourceInformationBuilder forContext(MemberEntity member) => this; | 67 SourceInformationBuilder forContext(covariant MemberEntity member) => this; |
67 | 68 |
68 /// Generate [SourceInformation] the declaration of the [member]. | 69 /// Generate [SourceInformation] the declaration of the [member]. |
69 SourceInformation buildDeclaration(MemberEntity member) => null; | 70 SourceInformation buildDeclaration(covariant MemberEntity member) => null; |
70 | 71 |
71 /// Generate [SourceInformation] for the generic [node]. | 72 /// Generate [SourceInformation] for the generic [node]. |
72 @deprecated | 73 @deprecated |
73 SourceInformation buildGeneric(Node node) => null; | 74 SourceInformation buildGeneric(Node node) => null; |
74 | 75 |
75 /// Generate [SourceInformation] for an instantiation of a class using [node] | 76 /// Generate [SourceInformation] for an instantiation of a class using [node] |
76 /// for the source position. | 77 /// for the source position. |
77 SourceInformation buildCreate(Node node) => null; | 78 SourceInformation buildCreate(Node node) => null; |
78 | 79 |
79 /// Generate [SourceInformation] for the return [node]. | 80 /// Generate [SourceInformation] for the return [node]. |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 @override | 320 @override |
320 int get line => null; | 321 int get line => null; |
321 | 322 |
322 @override | 323 @override |
323 int get offset => null; | 324 int get offset => null; |
324 | 325 |
325 String get shortName => '<no-location>'; | 326 String get shortName => '<no-location>'; |
326 | 327 |
327 String toString() => '<no-location>'; | 328 String toString() => '<no-location>'; |
328 } | 329 } |
OLD | NEW |