OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.resolution_strategy; | 5 library dart2js.resolution_strategy; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common_elements.dart'; | 8 import '../common_elements.dart'; |
9 import '../common/backend_api.dart'; | 9 import '../common/backend_api.dart'; |
10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
11 import '../common/resolution.dart'; | 11 import '../common/resolution.dart'; |
12 import '../common/tasks.dart'; | 12 import '../common/tasks.dart'; |
| 13 import '../compiler.dart'; |
13 import '../constants/values.dart'; | 14 import '../constants/values.dart'; |
14 import '../compiler.dart'; | |
15 import '../elements/elements.dart'; | 15 import '../elements/elements.dart'; |
16 import '../elements/entities.dart'; | 16 import '../elements/entities.dart'; |
17 import '../elements/modelx.dart'; | 17 import '../elements/modelx.dart'; |
18 import '../elements/resolution_types.dart'; | 18 import '../elements/resolution_types.dart'; |
19 import '../environment.dart'; | 19 import '../environment.dart'; |
20 import '../enqueue.dart'; | 20 import '../enqueue.dart'; |
21 import '../frontend_strategy.dart'; | 21 import '../frontend_strategy.dart'; |
22 import '../js_backend/backend.dart'; | 22 import '../js_backend/backend.dart'; |
23 import '../js_backend/backend_usage.dart'; | 23 import '../js_backend/backend_usage.dart'; |
24 import '../js_backend/custom_elements_analysis.dart'; | 24 import '../js_backend/custom_elements_analysis.dart'; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 @override | 418 @override |
419 ResolutionFunctionType getLocalFunctionType(LocalFunctionElement function) { | 419 ResolutionFunctionType getLocalFunctionType(LocalFunctionElement function) { |
420 return function.type; | 420 return function.type; |
421 } | 421 } |
422 | 422 |
423 @override | 423 @override |
424 ResolutionDartType getUnaliasedType(ResolutionDartType type) { | 424 ResolutionDartType getUnaliasedType(ResolutionDartType type) { |
425 type.computeUnaliased(_resolution); | 425 type.computeUnaliased(_resolution); |
426 return type.unaliased; | 426 return type.unaliased; |
427 } | 427 } |
| 428 |
| 429 @override |
| 430 Iterable<ConstantValue> getMemberMetadata(MemberElement element) { |
| 431 List<ConstantValue> values = <ConstantValue>[]; |
| 432 _compiler.reporter.withCurrentElement(element, () { |
| 433 for (MetadataAnnotation metadata in element.implementation.metadata) { |
| 434 metadata.ensureResolved(_compiler.resolution); |
| 435 assert(invariant(metadata, metadata.constant != null, |
| 436 message: "Unevaluated metadata constant.")); |
| 437 ConstantValue value = |
| 438 _compiler.constants.getConstantValue(metadata.constant); |
| 439 values.add(value); |
| 440 } |
| 441 }); |
| 442 return values; |
| 443 } |
428 } | 444 } |
429 | 445 |
430 /// AST-based logic for processing annotations. These annotations are processed | 446 /// AST-based logic for processing annotations. These annotations are processed |
431 /// very early in the compilation pipeline, typically this is before resolution | 447 /// very early in the compilation pipeline, typically this is before resolution |
432 /// is complete. Because of that this processor does a lightweight parse of the | 448 /// is complete. Because of that this processor does a lightweight parse of the |
433 /// annotation (which is restricted to a limited subset of the annotation | 449 /// annotation (which is restricted to a limited subset of the annotation |
434 /// syntax), and, once resolution completes, it validates that the parsed | 450 /// syntax), and, once resolution completes, it validates that the parsed |
435 /// annotations correspond to the correct element. | 451 /// annotations correspond to the correct element. |
436 class _ElementAnnotationProcessor implements AnnotationProcessor { | 452 class _ElementAnnotationProcessor implements AnnotationProcessor { |
437 Compiler _compiler; | 453 Compiler _compiler; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 } | 627 } |
612 } | 628 } |
613 }); | 629 }); |
614 }); | 630 }); |
615 } | 631 } |
616 | 632 |
617 _compiler.libraryLoader.libraries | 633 _compiler.libraryLoader.libraries |
618 .forEach(processJsInteropAnnotationsInLibrary); | 634 .forEach(processJsInteropAnnotationsInLibrary); |
619 } | 635 } |
620 } | 636 } |
OLD | NEW |