| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'package:front_end/src/fasta/scanner.dart' | 5 import 'package:front_end/src/fasta/scanner.dart' |
| 6 show BeginGroupToken, StringToken, Token; | 6 show BeginGroupToken, StringToken, Token; |
| 7 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN; | 7 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common_elements.dart' show CommonElements; | 10 import '../common_elements.dart' show CommonElements; |
| 11 import '../common/backend_api.dart'; | 11 import '../common/backend_api.dart'; |
| 12 import '../common/resolution.dart'; | 12 import '../common/resolution.dart'; |
| 13 import '../compiler.dart' show Compiler; | 13 import '../compiler.dart' show Compiler; |
| 14 import '../constants/values.dart'; | 14 import '../constants/values.dart'; |
| 15 import '../elements/elements.dart' | 15 import '../elements/elements.dart' |
| 16 show | 16 show |
| 17 ClassElement, | 17 ClassElement, |
| 18 Element, | 18 Element, |
| 19 FieldElement, | 19 FieldElement, |
| 20 LibraryElement, | 20 LibraryElement, |
| 21 MemberElement, | 21 MemberElement, |
| 22 MetadataAnnotation, | 22 MetadataAnnotation, |
| 23 MethodElement; | 23 MethodElement; |
| 24 import '../elements/entities.dart'; | 24 import '../elements/entities.dart'; |
| 25 import '../elements/modelx.dart' show FunctionElementX, MetadataAnnotationX; | 25 import '../elements/modelx.dart' show FunctionElementX, MetadataAnnotationX; |
| 26 import '../elements/resolution_types.dart' show ResolutionDartType; | 26 import '../elements/resolution_types.dart' show ResolutionDartType; |
| 27 import '../js_backend/js_backend.dart'; | 27 import '../js_backend/js_backend.dart'; |
| 28 import '../js_backend/native_data.dart'; | 28 import '../js_backend/native_data.dart'; |
| 29 import '../kernel/world_builder.dart' show KernelAnnotationProcessor; | 29 import '../kernel/element_map.dart' show KernelAnnotationProcessor; |
| 30 import '../patch_parser.dart'; | 30 import '../patch_parser.dart'; |
| 31 import '../tree/tree.dart'; | 31 import '../tree/tree.dart'; |
| 32 import 'behavior.dart'; | 32 import 'behavior.dart'; |
| 33 | 33 |
| 34 /// Class that performs the mechanics to investigate annotations in the code. | 34 /// Class that performs the mechanics to investigate annotations in the code. |
| 35 abstract class AnnotationProcessor { | 35 abstract class AnnotationProcessor { |
| 36 factory AnnotationProcessor(Compiler compiler) => | 36 factory AnnotationProcessor(Compiler compiler) => |
| 37 compiler.options.loadFromDill | 37 compiler.options.loadFromDill |
| 38 // TODO(johnniwinther): Pass the [KernelWorldBuilder] to | 38 // TODO(johnniwinther): Pass the [KernelWorldBuilder] to |
| 39 // [KernelAnnotationProcessor]. | 39 // [KernelAnnotationProcessor]. |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 605 |
| 606 Iterable<ConstantValue> fields = constructedObject.fields.values; | 606 Iterable<ConstantValue> fields = constructedObject.fields.values; |
| 607 // TODO(sra): Better validation of the constant. | 607 // TODO(sra): Better validation of the constant. |
| 608 if (fields.length != 1 || fields.single is! StringConstantValue) { | 608 if (fields.length != 1 || fields.single is! StringConstantValue) { |
| 609 throw new SpannableAssertionFailure( | 609 throw new SpannableAssertionFailure( |
| 610 spannable, 'Annotations needs one string: ${value.toStructuredText()}'); | 610 spannable, 'Annotations needs one string: ${value.toStructuredText()}'); |
| 611 } | 611 } |
| 612 StringConstantValue specStringConstant = fields.single; | 612 StringConstantValue specStringConstant = fields.single; |
| 613 return specStringConstant.toDartString().slowToString(); | 613 return specStringConstant.toDartString().slowToString(); |
| 614 } | 614 } |
| OLD | NEW |