| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 var previousIndex = | 361 var previousIndex = |
| 362 JSON.decode(new File('docs/index.json').readAsStringSync()); | 362 JSON.decode(new File('docs/index.json').readAsStringSync()); |
| 363 index.addAll(previousIndex); | 363 index.addAll(previousIndex); |
| 364 } | 364 } |
| 365 _writeToFile(JSON.encode(index), 'index.json'); | 365 _writeToFile(JSON.encode(index), 'index.json'); |
| 366 } | 366 } |
| 367 | 367 |
| 368 Library generateLibrary(dart2js.Dart2JsLibraryMirror library) { | 368 Library generateLibrary(dart2js.Dart2JsLibraryMirror library) { |
| 369 _currentLibrary = library; | 369 _currentLibrary = library; |
| 370 var result = new Library(docName(library), _commentToHtml(library), | 370 var result = new Library(docName(library), _commentToHtml(library), |
| 371 _variables(library.variables), | 371 _variables(library.variables), |
| 372 _methods(library.functions), | 372 _methods(library.functions), |
| 373 _classes(library.classes), _isHidden(library)); | 373 _classes(library.classes), _isHidden(library)); |
| 374 _findPackage(result, library); | 374 _findPackage(result, library); |
| 375 logger.fine('Generated library for ${result.name}'); | 375 logger.fine('Generated library for ${result.name}'); |
| 376 return result; | 376 return result; |
| 377 } | 377 } |
| 378 | 378 |
| 379 void _writeIndexableToFile(Indexable result, bool outputToYaml) { | 379 void _writeIndexableToFile(Indexable result, bool outputToYaml) { |
| 380 var outputFile = result.fileName; | 380 var outputFile = result.fileName; |
| 381 var output; | 381 var output; |
| 382 if (outputToYaml) { | 382 if (outputToYaml) { |
| 383 output = getYamlString(result.toMap()); | 383 output = getYamlString(result.toMap()); |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 String docName(DeclarationMirror m) { | 1325 String docName(DeclarationMirror m) { |
| 1326 if (m is LibraryMirror) { | 1326 if (m is LibraryMirror) { |
| 1327 return (m as LibraryMirror).qualifiedName.replaceAll('.','-'); | 1327 return (m as LibraryMirror).qualifiedName.replaceAll('.','-'); |
| 1328 } | 1328 } |
| 1329 var owner = m.owner; | 1329 var owner = m.owner; |
| 1330 if (owner == null) return m.qualifiedName; | 1330 if (owner == null) return m.qualifiedName; |
| 1331 // For the unnamed constructor we just return the class name. | 1331 // For the unnamed constructor we just return the class name. |
| 1332 if (m.simpleName == '') return docName(owner); | 1332 if (m.simpleName == '') return docName(owner); |
| 1333 return docName(owner) + '.' + m.simpleName; | 1333 return docName(owner) + '.' + m.simpleName; |
| 1334 } | 1334 } |
| OLD | NEW |