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

Side by Side Diff: pkg/docgen/lib/src/models/model_helpers.dart

Issue 929353004: Handle mutually recursive re-exports in dartdocgen (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « pkg/docgen/lib/src/models/library.dart ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 docgen.model_helpers; 5 library docgen.model_helpers;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:compiler/src/constants/expressions.dart'; 9 import 'package:compiler/src/constants/expressions.dart';
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 return map; 211 return map;
212 } 212 }
213 213
214 /// For the given library determine what items (if any) are exported. 214 /// For the given library determine what items (if any) are exported.
215 /// 215 ///
216 /// Returns a Map with three keys: "classes", "methods", and "variables" the 216 /// Returns a Map with three keys: "classes", "methods", and "variables" the
217 /// values of which point to a map of exported name identifiers with values 217 /// values of which point to a map of exported name identifiers with values
218 /// corresponding to the actual DeclarationMirror. 218 /// corresponding to the actual DeclarationMirror.
219 Map<String, Map<String, DeclarationMirror>> calcExportedItems( 219 Map<String, Map<String, DeclarationMirror>> calcExportedItems(
220 LibrarySourceMirror library) { 220 LibrarySourceMirror library, Map visited) {
tjblasi 2015/02/19 00:52:55 It seems a bit strange that this is a required par
Alan Knight 2015/02/19 01:07:04 We can't know in advance if it's recursive or not.
221 var exports = {}; 221 var exports = {};
222 visited[library] = exports;
222 exports['classes'] = new SplayTreeMap(); 223 exports['classes'] = new SplayTreeMap();
223 exports['methods'] = new SplayTreeMap(); 224 exports['methods'] = new SplayTreeMap();
224 exports['variables'] = new SplayTreeMap(); 225 exports['variables'] = new SplayTreeMap();
225 226
226 // Determine the classes, variables and methods that are exported for a 227 // Determine the classes, variables and methods that are exported for a
227 // specific dependency. 228 // specific dependency.
228 void _populateExports(LibraryDependencyMirror export, bool showExport) { 229 void _populateExports(LibraryDependencyMirror export, bool showExport) {
229 var transitiveExports = calcExportedItems(export.targetLibrary); 230 if (visited[export.targetLibrary] != null) return;
231 var transitiveExports = calcExportedItems(export.targetLibrary, visited);
230 exports['classes'].addAll(transitiveExports['classes']); 232 exports['classes'].addAll(transitiveExports['classes']);
231 exports['methods'].addAll(transitiveExports['methods']); 233 exports['methods'].addAll(transitiveExports['methods']);
232 exports['variables'].addAll(transitiveExports['variables']); 234 exports['variables'].addAll(transitiveExports['variables']);
233 // If there is a show in the export, add only the show items to the 235 // If there is a show in the export, add only the show items to the
234 // library. Ex: "export foo show bar" 236 // library. Ex: "export foo show bar"
235 // Otherwise, add all items, and then remove the hidden ones. 237 // Otherwise, add all items, and then remove the hidden ones.
236 // Ex: "export foo hide bar" 238 // Ex: "export foo hide bar"
237 239
238 if (!showExport) { 240 if (!showExport) {
239 // Add all items, and then remove the hidden ones. 241 // Add all items, and then remove the hidden ones.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // the time. 361 // the time.
360 var sdkLibrary = LIBRARIES[dart2js_util.nameOf(mirror)]; 362 var sdkLibrary = LIBRARIES[dart2js_util.nameOf(mirror)];
361 if (sdkLibrary != null) { 363 if (sdkLibrary != null) {
362 return !sdkLibrary.documented; 364 return !sdkLibrary.documented;
363 } else if (dart2js_util.nameOf(mirror).startsWith('_') || dart2js_util.nameOf( 365 } else if (dart2js_util.nameOf(mirror).startsWith('_') || dart2js_util.nameOf(
364 mirror).contains('._')) { 366 mirror).contains('._')) {
365 return true; 367 return true;
366 } 368 }
367 return false; 369 return false;
368 } 370 }
OLDNEW
« no previous file with comments | « pkg/docgen/lib/src/models/library.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698