Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// **docgen** is a tool for creating machine readable representations of Dart | 5 /// **docgen** is a tool for creating machine readable representations of Dart |
| 6 /// code metadata, including: classes, members, comments and annotations. | 6 /// code metadata, including: classes, members, comments and annotations. |
| 7 /// | 7 /// |
| 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. | 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. |
| 9 /// | 9 /// |
| 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] | 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 if (includeSdk || !lib.uri.toString().startsWith('dart:')) { | 298 if (includeSdk || !lib.uri.toString().startsWith('dart:')) { |
| 299 var library = generateLibrary(lib); | 299 var library = generateLibrary(lib); |
| 300 entityMap[library.name] = library; | 300 entityMap[library.name] = library; |
| 301 } | 301 } |
| 302 }); | 302 }); |
| 303 // After everything is created, do a pass through all classes to make sure no | 303 // After everything is created, do a pass through all classes to make sure no |
| 304 // intermediate classes created by mixins are included. | 304 // intermediate classes created by mixins are included. |
| 305 entityMap.values.where((e) => e is Class).forEach((c) => c.makeValid()); | 305 entityMap.values.where((e) => e is Class).forEach((c) => c.makeValid()); |
| 306 // Everything is a subclass of Object, therefore empty the list to avoid a | 306 // Everything is a subclass of Object, therefore empty the list to avoid a |
| 307 // giant list of subclasses to be printed out. | 307 // giant list of subclasses to be printed out. |
| 308 if (parseSdk) (entityMap['dart-core.Object'] as Class).subclasses.clear(); | 308 if (includeSdk) (entityMap['dart-core.Object'] as Class).subclasses.clear(); |
|
Emily Fortuna
2013/11/06 22:29:26
if (parseSdk || includeSdk) ?
Alan Knight
2013/11/06 23:16:30
includeSdk the parameter to this method is passed
| |
| 309 | 309 |
| 310 var filteredEntities = entityMap.values.where(_isVisible); | 310 var filteredEntities = entityMap.values.where(_isVisible); |
| 311 | 311 |
| 312 // Outputs a JSON file with all libraries and their preview comments. | 312 // Outputs a JSON file with all libraries and their preview comments. |
| 313 // This will help the viewer know what libraries are available to read in. | 313 // This will help the viewer know what libraries are available to read in. |
| 314 var libraryMap; | 314 var libraryMap; |
| 315 if (append) { | 315 if (append) { |
| 316 var docsDir = listDir('docs'); | 316 var docsDir = listDir('docs'); |
| 317 if (!docsDir.contains('docs/library_list.json')) { | 317 if (!docsDir.contains('docs/library_list.json')) { |
| 318 throw new StateError('No library_list.json'); | 318 throw new StateError('No library_list.json'); |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1238 String docName(DeclarationMirror m) { | 1238 String docName(DeclarationMirror m) { |
| 1239 if (m is LibraryMirror) { | 1239 if (m is LibraryMirror) { |
| 1240 return (m as LibraryMirror).qualifiedName.replaceAll('.','-'); | 1240 return (m as LibraryMirror).qualifiedName.replaceAll('.','-'); |
| 1241 } | 1241 } |
| 1242 var owner = m.owner; | 1242 var owner = m.owner; |
| 1243 if (owner == null) return m.qualifiedName; | 1243 if (owner == null) return m.qualifiedName; |
| 1244 // For the unnamed constructor we just return the class name. | 1244 // For the unnamed constructor we just return the class name. |
| 1245 if (m.simpleName == '') return docName(owner); | 1245 if (m.simpleName == '') return docName(owner); |
| 1246 return docName(owner) + '.' + m.simpleName; | 1246 return docName(owner) + '.' + m.simpleName; |
| 1247 } | 1247 } |
| OLD | NEW |