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

Side by Side Diff: pkg/docgen/lib/docgen.dart

Issue 18653005: Docgen returning a future (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/bin/docgen.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) 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 *
11 * $ dart docgen.dart [OPTIONS] [FILE/DIR] 11 * $ dart docgen.dart [OPTIONS] [FILE/DIR]
12 * 12 *
13 * This creates files called `docs/<library_name>.yaml` in your current 13 * This creates files called `docs/<library_name>.yaml` in your current
14 * working directory. 14 * working directory.
15 */ 15 */
16 library docgen; 16 library docgen;
17 17
18 import 'dart:io'; 18 import 'dart:io';
19 import 'dart:json'; 19 import 'dart:json';
20 import 'dart:async'; 20 import 'dart:async';
21 21
22 import 'package:args/args.dart';
23 import 'package:logging/logging.dart'; 22 import 'package:logging/logging.dart';
24 import 'package:markdown/markdown.dart' as markdown; 23 import 'package:markdown/markdown.dart' as markdown;
25 import 'package:pathos/path.dart' as path; 24 import 'package:pathos/path.dart' as path;
26 25
27 import 'dart2yaml.dart'; 26 import 'dart2yaml.dart';
28 import 'src/io.dart'; 27 import 'src/io.dart';
29 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; 28 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
30 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; 29 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
31 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro r.dart' 30 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro r.dart'
32 as dart2js; 31 as dart2js;
(...skipping 11 matching lines...) Expand all
44 43
45 /// Current class being documented to be used for comment links. 44 /// Current class being documented to be used for comment links.
46 ClassMirror _currentClass; 45 ClassMirror _currentClass;
47 46
48 /// Current member being documented to be used for comment links. 47 /// Current member being documented to be used for comment links.
49 MemberMirror _currentMember; 48 MemberMirror _currentMember;
50 49
51 /// Resolves reference links in doc comments. 50 /// Resolves reference links in doc comments.
52 markdown.Resolver linkResolver; 51 markdown.Resolver linkResolver;
53 52
54 /// Package directory of directory being analyzed.
55 String packageDir;
56
57 bool outputToYaml;
58 bool outputToJson;
59 bool includePrivate;
60 /// State for whether imported SDK libraries should also be outputted.
61 bool includeSdk;
62 /// State for whether all SDK libraries should be outputted.
63 bool parseSdk;
64
65 /** 53 /**
66 * Docgen constructor initializes the link resolver for markdown parsing. 54 * Docgen constructor initializes the link resolver for markdown parsing.
67 * Also initializes the command line arguments. 55 * Also initializes the command line arguments.
56 *
57 * [packageRoot] is the packages directory of the directory being analyzed.
58 * If [includeSdk] is 'true', then any SDK libraries explicitly imported will
59 * also be documented.
60 * If [parseSdk] is 'true', then all Dart SDK libraries will be documented.
61 * This option is useful when only the SDK libraries are needed.
68 */ 62 */
69 void docgen(ArgResults argResults) { 63 Future<bool> docgen(List<String> files, {String packageRoot,
70 _setCommandLineArguments(argResults); 64 bool outputToYaml: true, bool includePrivate: false, bool includeSdk: false,
65 bool parseSdk: false}) {
66 var docgenResult = new Completer<bool>();
67
68 if (packageRoot == null && !parseSdk) {
69 if (FileSystemEntity.typeSync(files.first)
70 == FileSystemEntityType.DIRECTORY) {
71 packageRoot = _findPackageRoot(files.first);
72 }
73 }
74 logger.info('Package Root: ${packageRoot}');
71 75
72 linkResolver = (name) => 76 linkResolver = (name) =>
73 fixReference(name, _currentLibrary, _currentClass, _currentMember); 77 fixReference(name, _currentLibrary, _currentClass, _currentMember);
74 78
75 getMirrorSystem(argResults.rest).then((MirrorSystem mirrorSystem) { 79 getMirrorSystem(files, packageRoot, parseSdk: parseSdk)
76 if (mirrorSystem.libraries.values.isEmpty) { 80 .then((MirrorSystem mirrorSystem) {
77 throw new StateError('No Library Mirrors.'); 81 if (mirrorSystem.libraries.isEmpty) {
78 } 82 throw new StateError('No library mirrors were created.');
79 _documentLibraries(mirrorSystem.libraries.values); 83 }
80 }); 84 _documentLibraries(mirrorSystem.libraries.values,
81 } 85 includeSdk: includeSdk, includePrivate: includePrivate,
82 86 outputToYaml: outputToYaml);
83 void _setCommandLineArguments(ArgResults argResults) { 87 }).then((e) => docgenResult.complete(true))
84 outputToYaml = argResults['yaml'] || argResults['output-format'] == 'yaml'; 88 .catchError((e) => docgenResult.complete(false));
85 outputToJson = argResults['json'] || argResults['output-format'] == 'json'; 89
86 if (outputToYaml && outputToJson) { 90 return docgenResult.future;
87 throw new ArgumentError('Cannot have contradictory output flags.');
88 }
89 outputToYaml = outputToYaml || !outputToJson;
90 includePrivate = argResults['include-private'];
91 parseSdk = argResults['parse-sdk'];
92 includeSdk = parseSdk || argResults['include-sdk'];
93 packageDir = argResults['package-root'];
94 if (packageDir != null) logger.info('Package Root: ${packageDir}');
95 } 91 }
96 92
97 List<String> _listLibraries(List<String> args) { 93 List<String> _listLibraries(List<String> args) {
98 // TODO(janicejl): At the moment, only have support to have either one file, 94 // TODO(janicejl): At the moment, only have support to have either one file,
99 // or one directory. This is because there can only be one package directory 95 // or one directory. This is because there can only be one package directory
100 // since only one docgen is created per run. 96 // since only one docgen is created per run.
101 if (args.length != 1) throw new UnsupportedError(USAGE); 97 if (args.length != 1) throw new UnsupportedError(USAGE);
102 var libraries = new List<String>(); 98 var libraries = new List<String>();
103 var type = FileSystemEntity.typeSync(args[0]); 99 var type = FileSystemEntity.typeSync(args[0]);
104 100
105 if (type == FileSystemEntityType.FILE) { 101 if (type == FileSystemEntityType.FILE) {
106 libraries.add(path.absolute(args[0])); 102 libraries.add(path.absolute(args[0]));
107 logger.info('Added to libraries: ${libraries.last}'); 103 logger.info('Added to libraries: ${libraries.last}');
108 } else { 104 } else {
109 libraries.addAll(_listDartFromDir(args[0])); 105 libraries.addAll(_listDartFromDir(args[0]));
110 } 106 }
111 return libraries; 107 return libraries;
112 } 108 }
113 109
114 List<String> _listDartFromDir(String args) { 110 List<String> _listDartFromDir(String args) {
115 var files = listDir(args, recursive: true); 111 var files = listDir(args, recursive: true);
116 if (packageDir == null) {
117 packageDir = files.firstWhere((f) =>
118 f.endsWith('/pubspec.yaml'), orElse: () => '');
119 if (packageDir != '') packageDir = path.dirname(packageDir) + '/packages';
120 logger.info('Package Directory: $packageDir');
121 }
122 // To avoid anaylzing package files twice, only files with paths not 112 // To avoid anaylzing package files twice, only files with paths not
123 // containing '/packages' will be added. The only exception is if the file to 113 // containing '/packages' will be added. The only exception is if the file to
124 // analyze already has a '/package' in its path. 114 // analyze already has a '/package' in its path.
125 return files.where((f) => f.endsWith('.dart') && 115 return files.where((f) => f.endsWith('.dart') &&
126 (!f.contains('/packages') || args.contains('/packages'))).toList() 116 (!f.contains('/packages') || args.contains('/packages'))).toList()
127 ..forEach((lib) => logger.info('Added to libraries: $lib')); 117 ..forEach((lib) => logger.info('Added to libraries: $lib'));
128 } 118 }
129 119
120 String _findPackageRoot(String directory) {
121 var files = listDir(directory, recursive: true);
122 // Return '' means that there was no pubspec.yaml and therefor no packageRoot.
123 String packageRoot = files.firstWhere((f) =>
124 f.endsWith('/pubspec.yaml'), orElse: () => '');
janicejl 2013/07/03 19:36:07 If the pubspec.yaml is in the current directory, I
125 if (packageRoot != '') {
126 packageRoot = path.dirname(packageRoot) + '/packages';
127 }
128 return packageRoot;
129 }
130
130 List<String> _listSdk() { 131 List<String> _listSdk() {
131 var sdk = new List<String>(); 132 var sdk = new List<String>();
132 LIBRARIES.forEach((String name, LibraryInfo info) { 133 LIBRARIES.forEach((String name, LibraryInfo info) {
133 if (info.documented) { 134 if (info.documented) {
134 sdk.add('dart:$name'); 135 sdk.add('dart:$name');
135 logger.info('Add to SDK: ${sdk.last}'); 136 logger.info('Add to SDK: ${sdk.last}');
136 } 137 }
137 }); 138 });
138 return sdk; 139 return sdk;
139 } 140 }
140 141
141 /** 142 /**
142 * Analyzes set of libraries by getting a mirror system and triggers the 143 * Analyzes set of libraries by getting a mirror system and triggers the
143 * documentation of the libraries. 144 * documentation of the libraries.
144 */ 145 */
145 Future<MirrorSystem> getMirrorSystem(List<String> args) { 146 Future<MirrorSystem> getMirrorSystem(List<String> args, String packageRoot,
147 {bool parseSdk:false}) {
146 var libraries = !parseSdk ? _listLibraries(args) : _listSdk(); 148 var libraries = !parseSdk ? _listLibraries(args) : _listSdk();
147 if (libraries.isEmpty) throw new StateError('No Libraries.'); 149 if (libraries.isEmpty) throw new StateError('No Libraries.');
148 // DART_SDK should be set to the root of the SDK library. 150 // DART_SDK should be set to the root of the SDK library.
149 var sdkRoot = Platform.environment['DART_SDK']; 151 var sdkRoot = Platform.environment['DART_SDK'];
150 if (sdkRoot != null) { 152 if (sdkRoot != null) {
151 logger.info('Using DART_SDK to find SDK at $sdkRoot'); 153 logger.info('Using DART_SDK to find SDK at $sdkRoot');
152 } else { 154 } else {
153 // If DART_SDK is not defined in the environment, 155 // If DART_SDK is not defined in the environment,
154 // assuming the dart executable is from the Dart SDK folder inside bin. 156 // assuming the dart executable is from the Dart SDK folder inside bin.
155 sdkRoot = path.dirname(path.dirname(new Options().executable)); 157 sdkRoot = path.dirname(path.dirname(new Options().executable));
156 logger.info('SDK Root: ${sdkRoot}'); 158 logger.info('SDK Root: ${sdkRoot}');
157 } 159 }
158 160
159 return _getMirrorSystemHelper(libraries, sdkRoot, packageRoot: packageDir); 161 return _analyzeLibraries(libraries, sdkRoot, packageRoot: packageRoot);
160 } 162 }
161 163
162 // TODO(janicejl): Should make docgen fail gracefully, or output a friendly 164 // TODO(janicejl): Should make docgen fail gracefully, or output a friendly
163 // error message letting them know why it is failing to create a mirror system. 165 // error message letting them know why it is failing to create a mirror system.
164 // If there is conflicting library names, should modify it with a hash at the 166 // If there is conflicting library names, should modify it with a hash at the
165 // end of it's library name. 167 // end of it's library name.
166 /** 168 /**
167 * Analyzes set of libraries and provides a mirror system which can be used 169 * Analyzes set of libraries and provides a mirror system which can be used
168 * for static inspection of the source code. 170 * for static inspection of the source code.
169 */ 171 */
170 Future<MirrorSystem> _getMirrorSystemHelper(List<String> libraries, 172 Future<MirrorSystem> _analyzeLibraries(List<String> libraries,
171 String libraryRoot, {String packageRoot}) { 173 String libraryRoot, {String packageRoot}) {
172 SourceFileProvider provider = new SourceFileProvider(); 174 SourceFileProvider provider = new SourceFileProvider();
173 api.DiagnosticHandler diagnosticHandler = 175 api.DiagnosticHandler diagnosticHandler =
174 new FormattingDiagnosticHandler(provider).diagnosticHandler; 176 new FormattingDiagnosticHandler(provider).diagnosticHandler;
175 Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot')); 177 Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
176 Uri packageUri = null; 178 Uri packageUri = null;
177 if (packageRoot != null) { 179 if (packageRoot != null) {
178 packageUri = currentDirectory.resolve(appendSlash('$packageRoot')); 180 packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
179 } 181 }
180 List<Uri> librariesUri = <Uri>[]; 182 List<Uri> librariesUri = <Uri>[];
181 libraries.forEach((library) { 183 libraries.forEach((library) {
182 librariesUri.add(currentDirectory.resolve(library)); 184 librariesUri.add(currentDirectory.resolve(library));
183 }); 185 });
184 return dart2js.analyze(librariesUri, libraryUri, packageUri, 186 return dart2js.analyze(librariesUri, libraryUri, packageUri,
185 provider.readStringFromUri, diagnosticHandler, 187 provider.readStringFromUri, diagnosticHandler,
186 ['--preserve-comments', '--categories=Client,Server']) 188 ['--preserve-comments', '--categories=Client,Server'])
187 ..catchError((error) { 189 ..catchError((error) {
188 logger.severe('Error: Failed to create mirror system. '); 190 logger.severe('Error: Failed to create mirror system. ');
189 // TODO(janicejl): Use the stack trace package when bug is resolved. 191 // TODO(janicejl): Use the stack trace package when bug is resolved.
190 // Currently, a string is thrown when it fails to create a mirror 192 // Currently, a string is thrown when it fails to create a mirror
191 // system, and it is not possible to use the stack trace. BUG(#11622) 193 // system, and it is not possible to use the stack trace. BUG(#11622)
192 // To avoid printing the stack trace. 194 // To avoid printing the stack trace.
193 exit(1); 195 exit(1);
194 }); 196 });
195 } 197 }
196 198
197 /** 199 /**
198 * Creates documentation for filtered libraries. 200 * Creates documentation for filtered libraries.
199 */ 201 */
200 void _documentLibraries(List<LibraryMirror> libraries) { 202 void _documentLibraries(List<LibraryMirror> libraries,
203 {bool includeSdk:false, bool includePrivate:false, bool
204 outputToYaml:true}) {
201 libraries.forEach((lib) { 205 libraries.forEach((lib) {
202 // Files belonging to the SDK have a uri that begins with 'dart:'. 206 // Files belonging to the SDK have a uri that begins with 'dart:'.
203 if (includeSdk || !lib.uri.toString().startsWith('dart:')) { 207 if (includeSdk || !lib.uri.toString().startsWith('dart:')) {
204 var library = generateLibrary(lib); 208 var library = generateLibrary(lib, includePrivate: includePrivate);
205 _outputLibrary(library); 209 _writeLibraryToFile(library, outputToYaml);
206 } 210 }
207 }); 211 });
208 // Outputs a text file with a list of files available after creating all 212 // Outputs a text file with a list of files available after creating all
209 // the libraries. This will help the viewer know what files are available 213 // the libraries. This will help the viewer know what files are available
210 // to read in. 214 // to read in.
211 _writeToFile(listDir("docs").join('\n'), 'library_list.txt'); 215 _writeToFile(listDir("docs").join('\n'), 'library_list.txt');
212 } 216 }
213 217
214 Library generateLibrary(dart2js.Dart2JsLibraryMirror library) { 218 Library generateLibrary(dart2js.Dart2JsLibraryMirror library,
219 {bool includePrivate:false}) {
215 _currentLibrary = library; 220 _currentLibrary = library;
216 var result = new Library(library.qualifiedName, _getComment(library), 221 var result = new Library(library.qualifiedName, _getComment(library),
217 _getVariables(library.variables), _getMethods(library.functions), 222 _getVariables(library.variables, includePrivate),
218 _getClasses(library.classes)); 223 _getMethods(library.functions, includePrivate),
224 _getClasses(library.classes, includePrivate));
219 logger.fine('Generated library for ${result.name}'); 225 logger.fine('Generated library for ${result.name}');
220 return result; 226 return result;
221 } 227 }
222 228
223 void _outputLibrary(Library result) { 229 void _writeLibraryToFile(Library result, bool outputToYaml) {
224 if (outputToJson) { 230 if (outputToYaml) {
231 _writeToFile(getYamlString(result.toMap()), '${result.name}.yaml');
232 } else {
225 _writeToFile(stringify(result.toMap()), '${result.name}.json'); 233 _writeToFile(stringify(result.toMap()), '${result.name}.json');
226 } 234 }
227 if (outputToYaml) { 235
228 _writeToFile(getYamlString(result.toMap()), '${result.name}.yaml');
229 }
230 } 236 }
231 237
232 /** 238 /**
233 * Returns a list of meta annotations assocated with a mirror. 239 * Returns a list of meta annotations assocated with a mirror.
234 */ 240 */
235 List<String> _getAnnotations(DeclarationMirror mirror) { 241 List<String> _getAnnotations(DeclarationMirror mirror) {
236 var annotations = mirror.metadata.where((e) => 242 var annotations = mirror.metadata.where((e) =>
237 e is dart2js.Dart2JsConstructedConstantMirror); 243 e is dart2js.Dart2JsConstructedConstantMirror);
238 return annotations.map((e) => e.type.qualifiedName).toList(); 244 return annotations.map((e) => e.type.qualifiedName).toList();
239 } 245 }
(...skipping 28 matching lines...) Expand all
268 // TODO(tmandel): Create proper links for [_] style markdown based 274 // TODO(tmandel): Create proper links for [_] style markdown based
269 // on scope once layout of viewer is finished. 275 // on scope once layout of viewer is finished.
270 markdown.Node fixReference(String name, LibraryMirror currentLibrary, 276 markdown.Node fixReference(String name, LibraryMirror currentLibrary,
271 ClassMirror currentClass, MemberMirror currentMember) { 277 ClassMirror currentClass, MemberMirror currentMember) {
272 return new markdown.Element.text('code', name); 278 return new markdown.Element.text('code', name);
273 } 279 }
274 280
275 /** 281 /**
276 * Returns a map of [Variable] objects constructed from inputted mirrors. 282 * Returns a map of [Variable] objects constructed from inputted mirrors.
277 */ 283 */
278 Map<String, Variable> _getVariables(Map<String, VariableMirror> mirrorMap) { 284 Map<String, Variable> _getVariables(Map<String, VariableMirror> mirrorMap,
285 bool includePrivate) {
279 var data = {}; 286 var data = {};
287 // TODO(janicejl): When map to map feature is created, replace the below with
288 // a filter. Issue(#9590).
280 mirrorMap.forEach((String mirrorName, VariableMirror mirror) { 289 mirrorMap.forEach((String mirrorName, VariableMirror mirror) {
281 if (includePrivate || !mirror.isPrivate) { 290 if (includePrivate || !mirror.isPrivate) {
282 _currentMember = mirror; 291 _currentMember = mirror;
283 data[mirrorName] = new Variable(mirrorName, mirror.qualifiedName, 292 data[mirrorName] = new Variable(mirrorName, mirror.qualifiedName,
284 mirror.isFinal, mirror.isStatic, mirror.type.qualifiedName, 293 mirror.isFinal, mirror.isStatic, mirror.type.qualifiedName,
285 _getComment(mirror), _getAnnotations(mirror)); 294 _getComment(mirror), _getAnnotations(mirror));
286 } 295 }
287 }); 296 });
288 return data; 297 return data;
289 } 298 }
290 299
291 /** 300 /**
292 * Returns a map of [Method] objects constructed from inputted mirrors. 301 * Returns a map of [Method] objects constructed from inputted mirrors.
293 */ 302 */
294 Map<String, Method> _getMethods(Map<String, MethodMirror> mirrorMap) { 303 Map<String, Method> _getMethods(Map<String, MethodMirror> mirrorMap,
304 bool includePrivate) {
295 var data = {}; 305 var data = {};
296 mirrorMap.forEach((String mirrorName, MethodMirror mirror) { 306 mirrorMap.forEach((String mirrorName, MethodMirror mirror) {
297 if (includePrivate || !mirror.isPrivate) { 307 if (includePrivate || !mirror.isPrivate) {
298 _currentMember = mirror; 308 _currentMember = mirror;
299 data[mirrorName] = new Method(mirrorName, mirror.qualifiedName, 309 data[mirrorName] = new Method(mirrorName, mirror.qualifiedName,
300 mirror.isSetter, mirror.isGetter, mirror.isConstructor, 310 mirror.isSetter, mirror.isGetter, mirror.isConstructor,
301 mirror.isOperator, mirror.isStatic, mirror.returnType.qualifiedName, 311 mirror.isOperator, mirror.isStatic, mirror.returnType.qualifiedName,
302 _getComment(mirror), _getParameters(mirror.parameters), 312 _getComment(mirror), _getParameters(mirror.parameters),
303 _getAnnotations(mirror)); 313 _getAnnotations(mirror));
304 } 314 }
305 }); 315 });
306 return data; 316 return data;
307 } 317 }
308 318
309 /** 319 /**
310 * Returns a map of [Class] objects constructed from inputted mirrors. 320 * Returns a map of [Class] objects constructed from inputted mirrors.
311 */ 321 */
312 Map<String, Class> _getClasses(Map<String, ClassMirror> mirrorMap) { 322 Map<String, Class> _getClasses(Map<String, ClassMirror> mirrorMap,
323 bool includePrivate) {
313 var data = {}; 324 var data = {};
314 mirrorMap.forEach((String mirrorName, ClassMirror mirror) { 325 mirrorMap.forEach((String mirrorName, ClassMirror mirror) {
315 if (includePrivate || !mirror.isPrivate) { 326 if (includePrivate || !mirror.isPrivate) {
316 _currentClass = mirror; 327 _currentClass = mirror;
317 var superclass = (mirror.superclass != null) ? 328 var superclass = (mirror.superclass != null) ?
318 mirror.superclass.qualifiedName : ''; 329 mirror.superclass.qualifiedName : '';
319 var interfaces = 330 var interfaces =
320 mirror.superinterfaces.map((interface) => interface.qualifiedName); 331 mirror.superinterfaces.map((interface) => interface.qualifiedName);
321 data[mirrorName] = new Class(mirrorName, mirror.qualifiedName, 332 data[mirrorName] = new Class(mirrorName, mirror.qualifiedName,
322 superclass, mirror.isAbstract, mirror.isTypedef, 333 superclass, mirror.isAbstract, mirror.isTypedef,
323 _getComment(mirror), interfaces.toList(), 334 _getComment(mirror), interfaces.toList(),
324 _getVariables(mirror.variables), _getMethods(mirror.methods), 335 _getVariables(mirror.variables, includePrivate),
336 _getMethods(mirror.methods, includePrivate),
325 _getAnnotations(mirror)); 337 _getAnnotations(mirror));
326 } 338 }
327 }); 339 });
328 return data; 340 return data;
329 } 341 }
330 342
331 /** 343 /**
332 * Returns a map of [Parameter] objects constructed from inputted mirrors. 344 * Returns a map of [Parameter] objects constructed from inputted mirrors.
333 */ 345 */
334 Map<String, Parameter> _getParameters(List<ParameterMirror> mirrorList) { 346 Map<String, Parameter> _getParameters(List<ParameterMirror> mirrorList) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 parameterMap['qualifiedname'] = qualifiedName; 567 parameterMap['qualifiedname'] = qualifiedName;
556 parameterMap['optional'] = isOptional.toString(); 568 parameterMap['optional'] = isOptional.toString();
557 parameterMap['named'] = isNamed.toString(); 569 parameterMap['named'] = isNamed.toString();
558 parameterMap['default'] = hasDefaultValue.toString(); 570 parameterMap['default'] = hasDefaultValue.toString();
559 parameterMap['type'] = type; 571 parameterMap['type'] = type;
560 parameterMap['value'] = defaultValue; 572 parameterMap['value'] = defaultValue;
561 parameterMap['annotations'] = new List.from(annotations); 573 parameterMap['annotations'] = new List.from(annotations);
562 return parameterMap; 574 return parameterMap;
563 } 575 }
564 } 576 }
OLDNEW
« no previous file with comments | « pkg/docgen/bin/docgen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698