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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/library_loader.dart

Issue 11747010: Process handled exports correctly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test added Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/reexport_core_helper.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * [CompilerTask] for loading libraries and setting up the import/export scopes. 8 * [CompilerTask] for loading libraries and setting up the import/export scopes.
9 */ 9 */
10 abstract class LibraryLoader extends CompilerTask { 10 abstract class LibraryLoader extends CompilerTask {
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 */ 523 */
524 void registerInitialExports() { 524 void registerInitialExports() {
525 pendingExportSet.addAll( 525 pendingExportSet.addAll(
526 library.localScope.values.filter((Element element) { 526 library.localScope.values.filter((Element element) {
527 // At this point [localScope] only contains members so we don't need 527 // At this point [localScope] only contains members so we don't need
528 // to check for foreign or prefix elements. 528 // to check for foreign or prefix elements.
529 return !element.name.isPrivate(); 529 return !element.name.isPrivate();
530 })); 530 }));
531 } 531 }
532 532
533 void registerHandledExports(LibraryElement exportedLibraryElement,
534 CombinatorFilter filter) {
535 assert(invariant(library, exportedLibraryElement.exportsHandled));
ahe 2013/01/04 08:46:35 This invariant is not using the correct location.
536 for (Element exportedElement in exportedLibraryElement.exports) {
537 if (!filter.exclude(exportedElement)) {
538 pendingExportSet.add(exportedElement);
539 }
540 }
541 }
542
533 /** 543 /**
534 * Registers the compute export scope with the node library. 544 * Registers the compute export scope with the node library.
535 */ 545 */
536 void registerExports() { 546 void registerExports() {
537 library.setExports(exportScope.values); 547 library.setExports(exportScope.values);
538 } 548 }
539 549
540 /** 550 /**
541 * Registers the imports of the node library. 551 * Registers the imports of the node library.
542 */ 552 */
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 690 }
681 691
682 /** 692 /**
683 * Registers that [library] depends on [loadedLibrary] through [tag]. 693 * Registers that [library] depends on [loadedLibrary] through [tag].
684 */ 694 */
685 void registerDependency(LibraryElement library, 695 void registerDependency(LibraryElement library,
686 LibraryDependency tag, 696 LibraryDependency tag,
687 LibraryElement loadedLibrary) { 697 LibraryElement loadedLibrary) {
688 if (tag is Export) { 698 if (tag is Export) {
689 // [loadedLibrary] is exported by [library]. 699 // [loadedLibrary] is exported by [library].
700 LibraryDependencyNode exportingNode = nodeMap[library];
690 if (loadedLibrary.exportsHandled) { 701 if (loadedLibrary.exportsHandled) {
691 // Export scope already computed on [loadedLibrary]. 702 // Export scope already computed on [loadedLibrary].
703 var combinatorFilter = new CombinatorFilter.fromTag(tag);
704 exportingNode.registerHandledExports(loadedLibrary, combinatorFilter);
692 return; 705 return;
693 } 706 }
694 LibraryDependencyNode exportedNode = nodeMap[loadedLibrary]; 707 LibraryDependencyNode exportedNode = nodeMap[loadedLibrary];
695 LibraryDependencyNode exportingNode = nodeMap[library];
696 assert(invariant(loadedLibrary, exportedNode != null, 708 assert(invariant(loadedLibrary, exportedNode != null,
697 message: "$loadedLibrary has not been registered")); 709 message: "$loadedLibrary has not been registered"));
698 assert(invariant(library, exportingNode != null, 710 assert(invariant(library, exportingNode != null,
699 message: "$library has not been registered")); 711 message: "$library has not been registered"));
700 exportedNode.registerExportDependency(tag, exportingNode); 712 exportedNode.registerExportDependency(tag, exportingNode);
701 } else if (tag == null || tag is Import) { 713 } else if (tag == null || tag is Import) {
702 // [loadedLibrary] is imported by [library]. 714 // [loadedLibrary] is imported by [library].
703 LibraryDependencyNode importingNode = nodeMap[library]; 715 LibraryDependencyNode importingNode = nodeMap[library];
704 assert(invariant(library, importingNode != null, 716 assert(invariant(library, importingNode != null,
705 message: "$library has not been registered")); 717 message: "$library has not been registered"));
706 importingNode.registerImportDependency(tag, loadedLibrary); 718 importingNode.registerImportDependency(tag, loadedLibrary);
707 } 719 }
708 } 720 }
709 721
710 /** 722 /**
711 * Registers [library] for the processing of its import/export scope. 723 * Registers [library] for the processing of its import/export scope.
712 */ 724 */
713 void registerNewLibrary(LibraryElement library) { 725 void registerNewLibrary(LibraryElement library) {
714 nodeMap[library] = new LibraryDependencyNode(library); 726 nodeMap[library] = new LibraryDependencyNode(library);
715 } 727 }
716 728
717 /** 729 /**
718 * Registers all top-level entities of [library] as starting point for the 730 * Registers all top-level entities of [library] as starting point for the
719 * fixed-point computation of the import/export scopes. 731 * fixed-point computation of the import/export scopes.
720 */ 732 */
721 void registerLibraryExports(LibraryElement library) { 733 void registerLibraryExports(LibraryElement library) {
722 nodeMap[library].registerInitialExports(); 734 nodeMap[library].registerInitialExports();
723 } 735 }
724 } 736 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/reexport_core_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698