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

Side by Side Diff: pkg/compiler/lib/src/deferred_load.dart

Issue 804333002: Add CoreTypes interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | Annotate | Revision Log
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 library deferred_load; 5 library deferred_load;
6 6
7 import 'constants/expressions.dart'; 7 import 'constants/expressions.dart';
8 import 'constants/values.dart' show 8 import 'constants/values.dart' show
9 ConstantValue, 9 ConstantValue,
10 ConstructedConstantValue, 10 ConstructedConstantValue,
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // imported library through non-deferred imports. 418 // imported library through non-deferred imports.
419 handleLibrary(LibraryElement library, Import deferredImport) { 419 handleLibrary(LibraryElement library, Import deferredImport) {
420 library.implementation.forEachLocalMember((Element element) { 420 library.implementation.forEachLocalMember((Element element) {
421 mapDependenciesIfResolved(element, deferredImport); 421 mapDependenciesIfResolved(element, deferredImport);
422 }); 422 });
423 423
424 for (MetadataAnnotation metadata in library.metadata) { 424 for (MetadataAnnotation metadata in library.metadata) {
425 ConstantExpression constant = 425 ConstantExpression constant =
426 backend.constants.getConstantForMetadata(metadata); 426 backend.constants.getConstantForMetadata(metadata);
427 if (constant != null) { 427 if (constant != null) {
428 _mapDependencies(constant.value.computeType(compiler).element, 428 _mapDependencies(constant.value.getType(compiler.coreTypes).element,
429 deferredImport); 429 deferredImport);
430 } 430 }
431 } 431 }
432 for (LibraryTag tag in library.tags) { 432 for (LibraryTag tag in library.tags) {
433 for (MetadataAnnotation metadata in tag.metadata) { 433 for (MetadataAnnotation metadata in tag.metadata) {
434 ConstantExpression constant = 434 ConstantExpression constant =
435 backend.constants.getConstantForMetadata(metadata); 435 backend.constants.getConstantForMetadata(metadata);
436 if (constant != null) { 436 if (constant != null) {
437 _mapDependencies(constant.value.computeType(compiler).element, 437 _mapDependencies(constant.value.getType(compiler.coreTypes).element,
438 deferredImport); 438 deferredImport);
439 } 439 }
440 } 440 }
441 } 441 }
442 } 442 }
443 443
444 for (Import deferredImport in _allDeferredImports.keys) { 444 for (Import deferredImport in _allDeferredImports.keys) {
445 LibraryElement deferredLibrary = _allDeferredImports[deferredImport]; 445 LibraryElement deferredLibrary = _allDeferredImports[deferredImport];
446 for (LibraryElement library in 446 for (LibraryElement library in
447 _nonDeferredReachableLibraries(deferredLibrary)) { 447 _nonDeferredReachableLibraries(deferredLibrary)) {
(...skipping 14 matching lines...) Expand all
462 if (import == _fakeMainImport) { 462 if (import == _fakeMainImport) {
463 result = "main"; 463 result = "main";
464 } else if (import.isDeferred) { 464 } else if (import.isDeferred) {
465 result = import.prefix.toString(); 465 result = import.prefix.toString();
466 } else { 466 } else {
467 Link<MetadataAnnotation> metadatas = import.metadata; 467 Link<MetadataAnnotation> metadatas = import.metadata;
468 assert(metadatas != null); 468 assert(metadatas != null);
469 for (MetadataAnnotation metadata in metadatas) { 469 for (MetadataAnnotation metadata in metadatas) {
470 metadata.ensureResolved(compiler); 470 metadata.ensureResolved(compiler);
471 Element element = 471 Element element =
472 metadata.constant.value.computeType(compiler).element; 472 metadata.constant.value.getType(compiler.coreTypes).element;
473 if (element == deferredLibraryClass) { 473 if (element == deferredLibraryClass) {
474 ConstructedConstantValue constant = metadata.constant.value; 474 ConstructedConstantValue constant = metadata.constant.value;
475 StringConstantValue s = constant.fields[0]; 475 StringConstantValue s = constant.fields[0];
476 result = s.primitiveValue.slowToString(); 476 result = s.primitiveValue.slowToString();
477 break; 477 break;
478 } 478 }
479 } 479 }
480 } 480 }
481 assert(result != null); 481 assert(result != null);
482 importDeferName[import] = makeUnique(result, usedImportNames);; 482 importDeferName[import] = makeUnique(result, usedImportNames);;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 for (LibraryTag tag in library.tags) { 650 for (LibraryTag tag in library.tags) {
651 if (tag is! Import) continue; 651 if (tag is! Import) continue;
652 Import import = tag; 652 Import import = tag;
653 653
654 /// Give an error if the old annotation-based syntax has been used. 654 /// Give an error if the old annotation-based syntax has been used.
655 Link<MetadataAnnotation> metadataList = import.metadata; 655 Link<MetadataAnnotation> metadataList = import.metadata;
656 if (metadataList != null) { 656 if (metadataList != null) {
657 for (MetadataAnnotation metadata in metadataList) { 657 for (MetadataAnnotation metadata in metadataList) {
658 metadata.ensureResolved(compiler); 658 metadata.ensureResolved(compiler);
659 Element element = 659 Element element =
660 metadata.constant.value.computeType(compiler).element; 660 metadata.constant.value.getType(compiler.coreTypes).element;
661 if (element == deferredLibraryClass) { 661 if (element == deferredLibraryClass) {
662 compiler.reportFatalError( 662 compiler.reportFatalError(
663 import, MessageKind.DEFERRED_OLD_SYNTAX); 663 import, MessageKind.DEFERRED_OLD_SYNTAX);
664 } 664 }
665 } 665 }
666 } 666 }
667 667
668 String prefix = (import.prefix != null) 668 String prefix = (import.prefix != null)
669 ? import.prefix.toString() 669 ? import.prefix.toString()
670 : null; 670 : null;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 Element maybePrefix = elements[identifier]; 758 Element maybePrefix = elements[identifier];
759 if (maybePrefix != null && maybePrefix.isPrefix) { 759 if (maybePrefix != null && maybePrefix.isPrefix) {
760 PrefixElement prefixElement = maybePrefix; 760 PrefixElement prefixElement = maybePrefix;
761 if (prefixElement.isDeferred) { 761 if (prefixElement.isDeferred) {
762 return prefixElement; 762 return prefixElement;
763 } 763 }
764 } 764 }
765 return null; 765 return null;
766 } 766 }
767 } 767 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698