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

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

Issue 2070493003: Revert "Remove Registry from registerMetadataConstant" and "Serialize metadata" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
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 import 'dart:collection' show Queue; 5 import 'dart:collection' show Queue;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart' show ForeignResolver; 8 import '../common/backend_api.dart' show ForeignResolver;
9 import '../common/registry.dart' show Registry; 9 import '../common/registry.dart' show Registry;
10 import '../common/resolution.dart' show Resolution; 10 import '../common/resolution.dart' show Resolution;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 ConstantValue value = 311 ConstantValue value =
312 compiler.constants.getConstantValue(annotation.constant); 312 compiler.constants.getConstantValue(annotation.constant);
313 if (!value.isConstructedObject) continue; 313 if (!value.isConstructedObject) continue;
314 ConstructedConstantValue constructedObject = value; 314 ConstructedConstantValue constructedObject = value;
315 if (constructedObject.type.element != annotationClass) continue; 315 if (constructedObject.type.element != annotationClass) continue;
316 316
317 Iterable<ConstantValue> fields = constructedObject.fields.values; 317 Iterable<ConstantValue> fields = constructedObject.fields.values;
318 // TODO(sra): Better validation of the constant. 318 // TODO(sra): Better validation of the constant.
319 if (fields.length != 1 || fields.single is! StringConstantValue) { 319 if (fields.length != 1 || fields.single is! StringConstantValue) {
320 reporter.internalError( 320 reporter.internalError(
321 annotation, 'Annotations needs one string: ${annotation}'); 321 annotation, 'Annotations needs one string: ${annotation.node}');
322 } 322 }
323 StringConstantValue specStringConstant = fields.single; 323 StringConstantValue specStringConstant = fields.single;
324 String specString = specStringConstant.toDartString().slowToString(); 324 String specString = specStringConstant.toDartString().slowToString();
325 if (name == null) { 325 if (name == null) {
326 name = specString; 326 name = specString;
327 } else { 327 } else {
328 reporter.internalError( 328 reporter.internalError(
329 annotation, 'Too many JSName annotations: ${annotation}'); 329 annotation, 'Too many JSName annotations: ${annotation.node}');
330 } 330 }
331 } 331 }
332 return name; 332 return name;
333 } 333 }
334 334
335 enqueueClass(ClassElement classElement, cause) { 335 enqueueClass(ClassElement classElement, cause) {
336 assert(unusedClasses.contains(classElement)); 336 assert(unusedClasses.contains(classElement));
337 unusedClasses.remove(classElement); 337 unusedClasses.remove(classElement);
338 pendingClasses.add(classElement); 338 pendingClasses.add(classElement);
339 queue.add(() { 339 queue.add(() {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 List<Element> directSubtypes = 672 List<Element> directSubtypes =
673 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); 673 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]);
674 directSubtypes.add(cls); 674 directSubtypes.add(cls);
675 } 675 }
676 676
677 void logSummary(log(message)) { 677 void logSummary(log(message)) {
678 log('Compiled ${registeredClasses.length} native classes, ' 678 log('Compiled ${registeredClasses.length} native classes, '
679 '${unusedClasses.length} native classes omitted.'); 679 '${unusedClasses.length} native classes omitted.');
680 } 680 }
681 } 681 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/constant_ordering.dart ('k') | pkg/compiler/lib/src/parser/element_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698