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 part of native; | 5 part of native; |
6 | 6 |
7 /** | 7 /** |
8 * This could be an abstract class but we use it as a stub for the dart_backend. | 8 * This could be an abstract class but we use it as a stub for the dart_backend. |
9 */ | 9 */ |
10 class NativeEnqueuer { | 10 class NativeEnqueuer { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 /// Returns the JSName annotation string or `null` if no JSName annotation is | 313 /// Returns the JSName annotation string or `null` if no JSName annotation is |
314 /// present. | 314 /// present. |
315 String findJsNameFromAnnotation(Element element) { | 315 String findJsNameFromAnnotation(Element element) { |
316 String name = null; | 316 String name = null; |
317 ClassElement annotationClass = annotationJsNameClass; | 317 ClassElement annotationClass = annotationJsNameClass; |
318 for (Link<MetadataAnnotation> link = element.metadata; | 318 for (Link<MetadataAnnotation> link = element.metadata; |
319 !link.isEmpty; | 319 !link.isEmpty; |
320 link = link.tail) { | 320 link = link.tail) { |
321 MetadataAnnotation annotation = link.head.ensureResolved(compiler); | 321 MetadataAnnotation annotation = link.head.ensureResolved(compiler); |
322 ConstantValue value = annotation.constant.value; | 322 ConstantValue value = |
| 323 compiler.constants.getConstantValue(annotation.constant); |
323 if (!value.isConstructedObject) continue; | 324 if (!value.isConstructedObject) continue; |
324 ConstructedConstantValue constructedObject = value; | 325 ConstructedConstantValue constructedObject = value; |
325 if (constructedObject.type.element != annotationClass) continue; | 326 if (constructedObject.type.element != annotationClass) continue; |
326 | 327 |
327 Iterable<ConstantValue> fields = constructedObject.fields.values; | 328 Iterable<ConstantValue> fields = constructedObject.fields.values; |
328 // TODO(sra): Better validation of the constant. | 329 // TODO(sra): Better validation of the constant. |
329 if (fields.length != 1 || fields.single is! StringConstantValue) { | 330 if (fields.length != 1 || fields.single is! StringConstantValue) { |
330 PartialMetadataAnnotation partial = annotation; | 331 PartialMetadataAnnotation partial = annotation; |
331 compiler.internalError(annotation, | 332 compiler.internalError(annotation, |
332 'Annotations needs one string: ${partial.parseNode(compiler)}'); | 333 'Annotations needs one string: ${partial.parseNode(compiler)}'); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 superclass, | 689 superclass, |
689 () => <ClassElement>[]); | 690 () => <ClassElement>[]); |
690 directSubtypes.add(cls); | 691 directSubtypes.add(cls); |
691 } | 692 } |
692 | 693 |
693 void logSummary(log(message)) { | 694 void logSummary(log(message)) { |
694 log('Compiled ${registeredClasses.length} native classes, ' | 695 log('Compiled ${registeredClasses.length} native classes, ' |
695 '${unusedClasses.length} native classes omitted.'); | 696 '${unusedClasses.length} native classes omitted.'); |
696 } | 697 } |
697 } | 698 } |
OLD | NEW |