OLD | NEW |
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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 dependencies.prepend(new ExportLink(export, exportingLibraryNode)); | 516 dependencies.prepend(new ExportLink(export, exportingLibraryNode)); |
517 } | 517 } |
518 | 518 |
519 /** | 519 /** |
520 * Registers all non-private locally declared members of the library of this | 520 * Registers all non-private locally declared members of the library of this |
521 * node to be exported. This forms the basis for the work-list computation of | 521 * node to be exported. This forms the basis for the work-list computation of |
522 * the export scopes performed in [LibraryDependencyHandler.computeExports]. | 522 * the export scopes performed in [LibraryDependencyHandler.computeExports]. |
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.where((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 /** | 533 /** |
534 * Registers the compute export scope with the node library. | 534 * Registers the compute export scope with the node library. |
535 */ | 535 */ |
536 void registerExports() { | 536 void registerExports() { |
537 library.setExports(exportScope.values); | 537 library.setExports(exportScope.values.toList()); |
538 } | 538 } |
539 | 539 |
540 /** | 540 /** |
541 * Registers the imports of the node library. | 541 * Registers the imports of the node library. |
542 */ | 542 */ |
543 void registerImports(Compiler compiler) { | 543 void registerImports(Compiler compiler) { |
544 for (ImportLink link in imports) { | 544 for (ImportLink link in imports) { |
545 link.importLibrary(compiler, library); | 545 link.importLibrary(compiler, library); |
546 } | 546 } |
547 } | 547 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 } | 715 } |
716 | 716 |
717 /** | 717 /** |
718 * Registers all top-level entities of [library] as starting point for the | 718 * Registers all top-level entities of [library] as starting point for the |
719 * fixed-point computation of the import/export scopes. | 719 * fixed-point computation of the import/export scopes. |
720 */ | 720 */ |
721 void registerLibraryExports(LibraryElement library) { | 721 void registerLibraryExports(LibraryElement library) { |
722 nodeMap[library].registerInitialExports(); | 722 nodeMap[library].registerInitialExports(); |
723 } | 723 } |
724 } | 724 } |
OLD | NEW |