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.common.resolution; | 5 library dart2js.common.resolution; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../constants/expressions.dart' show ConstantExpression; | 9 import '../constants/expressions.dart' show ConstantExpression; |
10 import '../core_types.dart' show CoreTypes; | 10 import '../core_types.dart' show CoreClasses, CoreTypes; |
11 import '../dart_types.dart' show DartType, InterfaceType; | 11 import '../dart_types.dart' show DartType, InterfaceType, Types; |
12 import '../elements/elements.dart' | 12 import '../elements/elements.dart' |
13 show | 13 show |
14 AstElement, | 14 AstElement, |
15 ClassElement, | 15 ClassElement, |
16 Element, | 16 Element, |
17 ExecutableElement, | 17 ExecutableElement, |
18 FunctionElement, | 18 FunctionElement, |
19 FunctionSignature, | 19 FunctionSignature, |
| 20 LibraryElement, |
20 MetadataAnnotation, | 21 MetadataAnnotation, |
21 ResolvedAst, | 22 ResolvedAst, |
22 TypedefElement; | 23 TypedefElement; |
23 import '../enqueue.dart' show ResolutionEnqueuer; | 24 import '../enqueue.dart' show ResolutionEnqueuer; |
24 import '../options.dart' show ParserOptions; | 25 import '../options.dart' show ParserOptions; |
25 import '../parser/element_listener.dart' show ScannerOptions; | 26 import '../parser/element_listener.dart' show ScannerOptions; |
26 import '../parser/parser_task.dart'; | 27 import '../parser/parser_task.dart'; |
27 import '../patch_parser.dart'; | 28 import '../patch_parser.dart'; |
28 import '../tree/tree.dart' show TypeAnnotation; | 29 import '../tree/tree.dart' show TypeAnnotation; |
29 import '../universe/world_impact.dart' show WorldImpact; | 30 import '../universe/world_impact.dart' show WorldImpact; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 189 } |
189 } | 190 } |
190 | 191 |
191 /// Interface for the accessing the front-end analysis. | 192 /// Interface for the accessing the front-end analysis. |
192 // TODO(johnniwinther): Find a better name for this. | 193 // TODO(johnniwinther): Find a better name for this. |
193 abstract class Frontend { | 194 abstract class Frontend { |
194 /// Returns the [ResolutionImpact] for [element]. | 195 /// Returns the [ResolutionImpact] for [element]. |
195 ResolutionImpact getResolutionImpact(Element element); | 196 ResolutionImpact getResolutionImpact(Element element); |
196 } | 197 } |
197 | 198 |
| 199 /// Interface defining target-specific behavior for resolution. |
| 200 abstract class Target { |
| 201 /// Returns `true` if [library] is a target specific library whose members |
| 202 /// have special treatment, such as being allowed to extends blacklisted |
| 203 /// classes or members being eagerly resolved. |
| 204 bool isTargetSpecificLibrary(LibraryElement element); |
| 205 } |
| 206 |
198 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. | 207 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. |
199 abstract class Resolution implements Frontend { | 208 abstract class Resolution implements Frontend { |
200 ParsingContext get parsingContext; | 209 ParsingContext get parsingContext; |
201 DiagnosticReporter get reporter; | 210 DiagnosticReporter get reporter; |
| 211 CoreClasses get coreClasses; |
202 CoreTypes get coreTypes; | 212 CoreTypes get coreTypes; |
| 213 Types get types; |
| 214 Target get target; |
203 | 215 |
204 /// If set to `true` resolution caches will not be cleared. Use this only for | 216 /// If set to `true` resolution caches will not be cleared. Use this only for |
205 /// testing. | 217 /// testing. |
206 bool retainCachesForTesting; | 218 bool retainCachesForTesting; |
207 | 219 |
208 void resolveTypedef(TypedefElement typdef); | 220 void resolveTypedef(TypedefElement typdef); |
209 void resolveClass(ClassElement cls); | 221 void resolveClass(ClassElement cls); |
210 void registerClass(ClassElement cls); | 222 void registerClass(ClassElement cls); |
211 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation); | 223 void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation); |
212 FunctionSignature resolveSignature(FunctionElement function); | 224 FunctionSignature resolveSignature(FunctionElement function); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 if (cls.isPatch) { | 314 if (cls.isPatch) { |
303 patchParser.parsePatchClassNode(cls); | 315 patchParser.parsePatchClassNode(cls); |
304 } | 316 } |
305 }); | 317 }); |
306 } | 318 } |
307 | 319 |
308 @override | 320 @override |
309 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( | 321 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( |
310 canUseNative: backend.canLibraryUseNative(element.library)); | 322 canUseNative: backend.canLibraryUseNative(element.library)); |
311 } | 323 } |
OLD | NEW |