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

Unified Diff: sdk/lib/_internal/compiler/implementation/native_handler.dart

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/native_handler.dart
diff --git a/sdk/lib/_internal/compiler/implementation/native_handler.dart b/sdk/lib/_internal/compiler/implementation/native_handler.dart
index f6a89b7e79930eb078a2cae80c69490d5d18d52a..d8379d886d1c3371d02d3a9a6ae535e768bfb10b 100644
--- a/sdk/lib/_internal/compiler/implementation/native_handler.dart
+++ b/sdk/lib/_internal/compiler/implementation/native_handler.dart
@@ -332,7 +332,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
!link.isEmpty;
link = link.tail) {
MetadataAnnotation annotation = link.head.ensureResolved(compiler);
- var value = annotation.value;
+ var value = annotation.constant;
if (value is! ConstructedConstant) continue;
if (value.type is! InterfaceType) continue;
if (!identical(value.type.element, annotationClass)) continue;
@@ -1099,19 +1099,20 @@ class NativeBehavior {
!link.isEmpty;
link = link.tail) {
MetadataAnnotation annotation = link.head.ensureResolved(compiler);
- var value = annotation.value;
- if (value is! ConstructedConstant) continue;
- if (value.type is! InterfaceType) continue;
- if (!identical(value.type.element, annotationClass)) continue;
+ Constant value = annotation.constant.value;
+ if (!value.isConstructedObject) continue;
+ ConstructedConstant constructedObject = value;
+ if (constructedObject.type.element != annotationClass) continue;
- var fields = value.fields;
+ List<Constant> fields = constructedObject.fields;
// TODO(sra): Better validation of the constant.
- if (fields.length != 1 || fields[0] is! StringConstant) {
+ if (fields.length != 1 || !fields[0].isString) {
PartialMetadataAnnotation partial = annotation;
compiler.internalError(annotation,
'Annotations needs one string: ${partial.parseNode(compiler)}');
}
- String specString = fields[0].toDartString().slowToString();
+ StringConstant specStringConstant = fields[0];
+ String specString = specStringConstant.toDartString().slowToString();
for (final typeString in specString.split('|')) {
var type = _parseType(typeString, compiler, lookup, annotation);
if (types == null) types = [];

Powered by Google App Engine
This is Rietveld 408576698