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

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

Issue 793653003: Display exports that lead to dart:mirrors. (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
« no previous file with comments | « no previous file | tests/compiler/dart2js/import_mirrors_test.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 library dart2js.library_loader; 5 library dart2js.library_loader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart2jslib.dart' 8 import 'dart2jslib.dart'
9 show Compiler, 9 show Compiler,
10 CompilerTask, 10 CompilerTask,
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 static int hashCodeCounter = 0; 701 static int hashCodeCounter = 0;
702 702
703 703
704 /** 704 /**
705 * A linked list of the import tags that import [library] mapped to the 705 * A linked list of the import tags that import [library] mapped to the
706 * corresponding libraries. This is used to propagate exports into imports 706 * corresponding libraries. This is used to propagate exports into imports
707 * after the export scopes have been computed. 707 * after the export scopes have been computed.
708 */ 708 */
709 Link<ImportLink> imports = const Link<ImportLink>(); 709 Link<ImportLink> imports = const Link<ImportLink>();
710 710
711 /// A linked list of all libraries directly exported by [library].
712 Link<LibraryElement> exports = const Link<LibraryElement>();
713
711 /** 714 /**
712 * A linked list of the export tags the dependent upon this node library. 715 * A linked list of the export tags the dependent upon this node library.
713 * This is used to propagate exports during the computation of export scopes. 716 * This is used to propagate exports during the computation of export scopes.
714 */ 717 */
715 Link<ExportLink> dependencies = const Link<ExportLink>(); 718 Link<ExportLink> dependencies = const Link<ExportLink>();
716 719
717 /** 720 /**
718 * The export scope for [library] which is gradually computed by the work-list 721 * The export scope for [library] which is gradually computed by the work-list
719 * computation in [LibraryDependencyHandler.computeExports]. 722 * computation in [LibraryDependencyHandler.computeExports].
720 */ 723 */
(...skipping 22 matching lines...) Expand all
743 LibraryElement importedLibrary) { 746 LibraryElement importedLibrary) {
744 imports = imports.prepend(new ImportLink(import, importedLibrary)); 747 imports = imports.prepend(new ImportLink(import, importedLibrary));
745 } 748 }
746 749
747 /** 750 /**
748 * Registers that the library of this node is exported by 751 * Registers that the library of this node is exported by
749 * [exportingLibraryNode] through the [export] tag. 752 * [exportingLibraryNode] through the [export] tag.
750 */ 753 */
751 void registerExportDependency(Export export, 754 void registerExportDependency(Export export,
752 LibraryDependencyNode exportingLibraryNode) { 755 LibraryDependencyNode exportingLibraryNode) {
756 // Register the exported library in the exporting library node.
757 exportingLibraryNode.exports =
758 exportingLibraryNode.exports.prepend(library);
759 // Register the export in the exported library node.
753 dependencies = 760 dependencies =
754 dependencies.prepend(new ExportLink(export, exportingLibraryNode)); 761 dependencies.prepend(new ExportLink(export, exportingLibraryNode));
755 } 762 }
756 763
757 /** 764 /**
758 * Registers all non-private locally declared members of the library of this 765 * Registers all non-private locally declared members of the library of this
759 * node to be exported. This forms the basis for the work-list computation of 766 * node to be exported. This forms the basis for the work-list computation of
760 * the export scopes performed in [LibraryDependencyHandler.computeExports]. 767 * the export scopes performed in [LibraryDependencyHandler.computeExports].
761 */ 768 */
762 void registerInitialExports() { 769 void registerInitialExports() {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 Link<Uri> prefix) { 1104 Link<Uri> prefix) {
1098 if (aborted) return; 1105 if (aborted) return;
1099 1106
1100 Uri canonicalUri = library.canonicalUri; 1107 Uri canonicalUri = library.canonicalUri;
1101 prefix = prefix.prepend(canonicalUri); 1108 prefix = prefix.prepend(canonicalUri);
1102 if (suffixChainMap.containsKey(library)) return; 1109 if (suffixChainMap.containsKey(library)) return;
1103 suffixChainMap[library] = const <Link<Uri>>[]; 1110 suffixChainMap[library] = const <Link<Uri>>[];
1104 List<Link<Uri>> suffixes = []; 1111 List<Link<Uri>> suffixes = [];
1105 if (targetUri != canonicalUri) { 1112 if (targetUri != canonicalUri) {
1106 LibraryDependencyNode node = nodeMap[library]; 1113 LibraryDependencyNode node = nodeMap[library];
1107 for (ImportLink import in node.imports.reverse()) { 1114
1115 /// Process the import (or export) of [importedLibrary].
1116 void processLibrary(LibraryElement importedLibrary) {
1108 bool suffixesArePrecomputed = 1117 bool suffixesArePrecomputed =
1109 suffixChainMap.containsKey(import.importedLibrary); 1118 suffixChainMap.containsKey(importedLibrary);
1110 1119
1111 if (!suffixesArePrecomputed) { 1120 if (!suffixesArePrecomputed) {
1112 computeSuffixes(import.importedLibrary, prefix); 1121 computeSuffixes(importedLibrary, prefix);
1113 if (aborted) return; 1122 if (aborted) return;
1114 } 1123 }
1115 1124
1116 for (Link<Uri> suffix in suffixChainMap[import.importedLibrary]) { 1125 for (Link<Uri> suffix in suffixChainMap[importedLibrary]) {
1117 suffixes.add(suffix.prepend(canonicalUri)); 1126 suffixes.add(suffix.prepend(canonicalUri));
1118 1127
1119 if (suffixesArePrecomputed) { 1128 if (suffixesArePrecomputed) {
1120 // Only report chains through [import] if the suffixes had already 1129 // Only report chains through [import] if the suffixes had already
1121 // been computed, otherwise [computeSuffixes] have reported the 1130 // been computed, otherwise [computeSuffixes] have reported the
1122 // paths through [prefix]. 1131 // paths through [prefix].
1123 Link<Uri> chain = prefix; 1132 Link<Uri> chain = prefix;
1124 while (!suffix.isEmpty) { 1133 while (!suffix.isEmpty) {
1125 chain = chain.prepend(suffix.head); 1134 chain = chain.prepend(suffix.head);
1126 suffix = suffix.tail; 1135 suffix = suffix.tail;
1127 } 1136 }
1128 if (!callback(chain)) { 1137 if (!callback(chain)) {
1129 aborted = true; 1138 aborted = true;
1130 return; 1139 return;
1131 } 1140 }
1132 } 1141 }
1133 } 1142 }
1134 } 1143 }
1144
1145 for (ImportLink import in node.imports.reverse()) {
1146 processLibrary(import.importedLibrary);
1147 if (aborted) return;
1148 }
1149 for (LibraryElement exportedLibrary in node.exports.reverse()) {
1150 processLibrary(exportedLibrary);
1151 if (aborted) return;
1152 }
1135 } else { // Here `targetUri == canonicalUri`. 1153 } else { // Here `targetUri == canonicalUri`.
1136 if (!callback(prefix)) { 1154 if (!callback(prefix)) {
1137 aborted = true; 1155 aborted = true;
1138 return; 1156 return;
1139 } 1157 }
1140 suffixes.add(const Link<Uri>().prepend(canonicalUri)); 1158 suffixes.add(const Link<Uri>().prepend(canonicalUri));
1141 } 1159 }
1142 suffixChainMap[library] = suffixes; 1160 suffixChainMap[library] = suffixes;
1143 return; 1161 return;
1144 } 1162 }
1145 1163
1146 computeSuffixes(rootLibrary, const Link<Uri>()); 1164 computeSuffixes(rootLibrary, const Link<Uri>());
1147 } 1165 }
1148 } 1166 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/import_mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698