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

Unified Diff: sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart

Issue 14645015: Use LibraryDependencyMirror in dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart b/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart
index 41a085e67cb02f9a03bc9f855be234a0b88de451..07f407a59c7e8132614b759dcc9ef4bf72345db8 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart
@@ -159,3 +159,29 @@ String stripComment(String comment) {
}
throw new ArgumentError('Invalid comment $comment');
}
+
+/**
+ * Returns an iterable over all exports found transitively from [library].
+ */
+Iterable<LibraryDependencyMirror> getExports(LibraryMirror library) {
+ bool isExport(LibraryDependencyMirror mirror) => mirror.isExport;
+
+ List<LibraryDependencyMirror> exports = <LibraryDependencyMirror>[];
+
+ Set<LibraryMirror> seenLibrarySet = new Set<LibraryMirror>();
+ Queue<LibraryDependencyMirror> pendingExports =
+ new Queue<LibraryDependencyMirror>();
+
+ seenLibrarySet.add(library);
+ pendingExports.addAll(library.libraryDependencies.where(isExport));
+
+ while (!pendingExports.isEmpty) {
+ LibraryDependencyMirror export = pendingExports.removeFirst();
+ exports.add(export);
+ LibraryMirror target = export.targetLibrary;
+ if (!seenLibrarySet.contains(target)) {
+ pendingExports.addAll(target.libraryDependencies.where(isExport));
+ }
+ }
+ return exports;
+}
« no previous file with comments | « no previous file | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698