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

Side by Side 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, 7 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 | sdk/lib/_internal/dartdoc/lib/dartdoc.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 mirrors_util; 5 library mirrors_util;
6 6
7 import 'dart:collection' show Queue, IterableBase; 7 import 'dart:collection' show Queue, IterableBase;
8 8
9 // TODO(rnystrom): Use "package:" URL (#4968). 9 // TODO(rnystrom): Use "package:" URL (#4968).
10 import 'mirrors.dart'; 10 import 'mirrors.dart';
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // * Foo 152 // * Foo
153 // */ 153 // */
154 // as "\nFoo\n" and not as "\nFoo\n ". 154 // as "\nFoo\n" and not as "\nFoo\n ".
155 sb.write(line); 155 sb.write(line);
156 } 156 }
157 } 157 }
158 return sb.toString(); 158 return sb.toString();
159 } 159 }
160 throw new ArgumentError('Invalid comment $comment'); 160 throw new ArgumentError('Invalid comment $comment');
161 } 161 }
162
163 /**
164 * Returns an iterable over all exports found transitively from [library].
165 */
166 Iterable<LibraryDependencyMirror> getExports(LibraryMirror library) {
167 bool isExport(LibraryDependencyMirror mirror) => mirror.isExport;
168
169 List<LibraryDependencyMirror> exports = <LibraryDependencyMirror>[];
170
171 Set<LibraryMirror> seenLibrarySet = new Set<LibraryMirror>();
172 Queue<LibraryDependencyMirror> pendingExports =
173 new Queue<LibraryDependencyMirror>();
174
175 seenLibrarySet.add(library);
176 pendingExports.addAll(library.libraryDependencies.where(isExport));
177
178 while (!pendingExports.isEmpty) {
179 LibraryDependencyMirror export = pendingExports.removeFirst();
180 exports.add(export);
181 LibraryMirror target = export.targetLibrary;
182 if (!seenLibrarySet.contains(target)) {
183 pendingExports.addAll(target.libraryDependencies.where(isExport));
184 }
185 }
186 return exports;
187 }
OLDNEW
« 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