| 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 /** | 5 /** |
| 6 * **docgen** is a tool for creating machine readable representations of Dart | 6 * **docgen** is a tool for creating machine readable representations of Dart |
| 7 * code metadata, including: classes, members, comments and annotations. | 7 * code metadata, including: classes, members, comments and annotations. |
| 8 * | 8 * |
| 9 * docgen is run on a `.dart` file or a directory containing `.dart` files. | 9 * docgen is run on a `.dart` file or a directory containing `.dart` files. |
| 10 * | 10 * |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 Uri packageUri = null; | 175 Uri packageUri = null; |
| 176 if (packageRoot != null) { | 176 if (packageRoot != null) { |
| 177 packageUri = currentDirectory.resolve(appendSlash('$packageRoot')); | 177 packageUri = currentDirectory.resolve(appendSlash('$packageRoot')); |
| 178 } | 178 } |
| 179 List<Uri> librariesUri = <Uri>[]; | 179 List<Uri> librariesUri = <Uri>[]; |
| 180 libraries.forEach((library) { | 180 libraries.forEach((library) { |
| 181 librariesUri.add(currentDirectory.resolve(library)); | 181 librariesUri.add(currentDirectory.resolve(library)); |
| 182 }); | 182 }); |
| 183 return dart2js.analyze(librariesUri, libraryUri, packageUri, | 183 return dart2js.analyze(librariesUri, libraryUri, packageUri, |
| 184 provider.readStringFromUri, diagnosticHandler, | 184 provider.readStringFromUri, diagnosticHandler, |
| 185 ['--preserve-comments', '--categories=Client,Server']); | 185 ['--preserve-comments', '--categories=Client,Server']) |
| 186 ..catchError((error) { |
| 187 logger.severe('Error: Failed to create mirror system. '); |
| 188 // TODO(janicejl): Use the stack trace package when bug is resolved. |
| 189 // Currently, a string is thrown when it fails to create a mirror |
| 190 // system, and it is not possible to use the stack trace. BUG(#11622) |
| 191 // To avoid printing the stack trace. |
| 192 exit(1); |
| 193 }); |
| 186 } | 194 } |
| 187 | 195 |
| 188 /** | 196 /** |
| 189 * Creates documentation for filtered libraries. | 197 * Creates documentation for filtered libraries. |
| 190 */ | 198 */ |
| 191 void _documentLibraries(List<LibraryMirror> libraries) { | 199 void _documentLibraries(List<LibraryMirror> libraries) { |
| 192 libraries.forEach((lib) { | 200 libraries.forEach((lib) { |
| 193 // Files belonging to the SDK have a uri that begins with 'dart:'. | 201 // Files belonging to the SDK have a uri that begins with 'dart:'. |
| 194 if (includeSdk || !lib.uri.toString().startsWith('dart:')) { | 202 if (includeSdk || !lib.uri.toString().startsWith('dart:')) { |
| 195 var library = generateLibrary(lib); | 203 var library = generateLibrary(lib); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 parameterMap['qualifiedname'] = qualifiedName; | 554 parameterMap['qualifiedname'] = qualifiedName; |
| 547 parameterMap['optional'] = isOptional.toString(); | 555 parameterMap['optional'] = isOptional.toString(); |
| 548 parameterMap['named'] = isNamed.toString(); | 556 parameterMap['named'] = isNamed.toString(); |
| 549 parameterMap['default'] = hasDefaultValue.toString(); | 557 parameterMap['default'] = hasDefaultValue.toString(); |
| 550 parameterMap['type'] = type; | 558 parameterMap['type'] = type; |
| 551 parameterMap['value'] = defaultValue; | 559 parameterMap['value'] = defaultValue; |
| 552 parameterMap['annotations'] = new List.from(annotations); | 560 parameterMap['annotations'] = new List.from(annotations); |
| 553 return parameterMap; | 561 return parameterMap; |
| 554 } | 562 } |
| 555 } | 563 } |
| OLD | NEW |