Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: pkg/compiler/lib/src/native/behavior.dart

Issue 1148343004: Remove ConstantExpression.value (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/mirrors_used.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// This class is a temporary work-around until we get a more powerful DartType. 7 /// This class is a temporary work-around until we get a more powerful DartType.
8 class SpecialType { 8 class SpecialType {
9 final String name; 9 final String name;
10 const SpecialType._(this.name); 10 const SpecialType._(this.name);
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 * [annotationClass]. 682 * [annotationClass].
683 * Returns `null` if no constraints. 683 * Returns `null` if no constraints.
684 */ 684 */
685 static _collect(Element element, Compiler compiler, Element annotationClass, 685 static _collect(Element element, Compiler compiler, Element annotationClass,
686 lookup(str)) { 686 lookup(str)) {
687 var types = null; 687 var types = null;
688 for (Link<MetadataAnnotation> link = element.metadata; 688 for (Link<MetadataAnnotation> link = element.metadata;
689 !link.isEmpty; 689 !link.isEmpty;
690 link = link.tail) { 690 link = link.tail) {
691 MetadataAnnotation annotation = link.head.ensureResolved(compiler); 691 MetadataAnnotation annotation = link.head.ensureResolved(compiler);
692 ConstantValue value = annotation.constant.value; 692 ConstantValue value =
693 compiler.constants.getConstantValue(annotation.constant);
693 if (!value.isConstructedObject) continue; 694 if (!value.isConstructedObject) continue;
694 ConstructedConstantValue constructedObject = value; 695 ConstructedConstantValue constructedObject = value;
695 if (constructedObject.type.element != annotationClass) continue; 696 if (constructedObject.type.element != annotationClass) continue;
696 697
697 Iterable<ConstantValue> fields = constructedObject.fields.values; 698 Iterable<ConstantValue> fields = constructedObject.fields.values;
698 // TODO(sra): Better validation of the constant. 699 // TODO(sra): Better validation of the constant.
699 if (fields.length != 1 || !fields.single.isString) { 700 if (fields.length != 1 || !fields.single.isString) {
700 PartialMetadataAnnotation partial = annotation; 701 PartialMetadataAnnotation partial = annotation;
701 compiler.internalError(annotation, 702 compiler.internalError(annotation,
702 'Annotations needs one string: ${partial.parseNode(compiler)}'); 703 'Annotations needs one string: ${partial.parseNode(compiler)}');
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 MessageKind.GENERIC, 771 MessageKind.GENERIC,
771 {'text': "Type '$typeString' not found."}); 772 {'text': "Type '$typeString' not found."});
772 return const DynamicType(); 773 return const DynamicType();
773 } 774 }
774 775
775 static _errorNode(locationNodeOrElement, compiler) { 776 static _errorNode(locationNodeOrElement, compiler) {
776 if (locationNodeOrElement is Node) return locationNodeOrElement; 777 if (locationNodeOrElement is Node) return locationNodeOrElement;
777 return locationNodeOrElement.parseNode(compiler); 778 return locationNodeOrElement.parseNode(compiler);
778 } 779 }
779 } 780 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/mirrors_used.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698