Chromium Code Reviews| Index: pkg/docgen/lib/docgen.dart |
| diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart |
| index 239d08a76056b204a6280ae97ef76727ac68e39f..84795d9aad07ea2e5ae17c5b68351031ad1f874f 100644 |
| --- a/pkg/docgen/lib/docgen.dart |
| +++ b/pkg/docgen/lib/docgen.dart |
| @@ -367,10 +367,22 @@ void _documentLibraries(List<LibraryMirror> libs, {bool includeSdk: false, |
| Library generateLibrary(dart2js.Dart2JsLibraryMirror library) { |
| _currentLibrary = library; |
| - var result = new Library(docName(library), _commentToHtml(library), |
| - _variables(library.variables), |
| - _methods(library.functions), |
| - _classes(library.classes), _isHidden(library)); |
| + |
| + filterMap(map, predicate) { |
| + var result = new Map(); |
| + map.forEach((key, value) { |
| + if (predicate(value)) result[key] = value; |
| + }); |
| + return result; |
| + } |
| + |
| + var result = new Library( |
| + docName(library), |
| + _commentToHtml(library), |
| + _variables(filterMap(library.declarations, (d) => d is VariableMirror)), |
| + _methods(filterMap(library.declarations, (d) => d is MethodMirror)), |
| + _classes(filterMap(library.declarations, (d) => d is ClassMirror)), |
| + _isHidden(library)); |
| _findPackage(result, library); |
| logger.fine('Generated library for ${result.name}'); |
| return result; |
| @@ -563,6 +575,14 @@ MethodGroup _methods(Map<String, MethodMirror> mirrorMap) { |
| /// Returns the [Class] for the given [mirror] has already been created, and if |
| /// it does not exist, creates it. |
| Class _class(ClassMirror mirror) { |
| + filterMap(map, predicate) { |
| + var result = new Map(); |
| + map.forEach((key, value) { |
| + if (predicate(value)) result[key] = value; |
| + }); |
| + return result; |
| + } |
|
gbracha
2013/11/07 00:09:11
Could we make this function shared library-wide (p
rmacnak
2013/11/07 00:18:29
Done.
|
| + |
| var clazz = entityMap[docName(mirror)]; |
| if (clazz == null) { |
| var superclass = mirror.superclass != null ? |
| @@ -570,8 +590,10 @@ Class _class(ClassMirror mirror) { |
| var interfaces = |
| mirror.superinterfaces.map((interface) => _class(interface)); |
| clazz = new Class(mirror.simpleName, superclass, _commentToHtml(mirror), |
| - interfaces.toList(), _variables(mirror.variables), |
| - _methods(mirror.methods), _annotations(mirror), _generics(mirror), |
| + interfaces.toList(), |
| + _variables(filterMap(mirror.declarations, (d) => d is VariableMirror)), |
| + _methods(filterMap(mirror.declarations, (d) => d is MethodMirror)), |
|
gbracha
2013/11/07 00:09:11
This now gets you constructors that were not in th
rmacnak
2013/11/07 00:18:29
Fixed.
|
| + _annotations(mirror), _generics(mirror), |
| docName(mirror), _isHidden(mirror), docName(mirror.owner), |
| mirror.isAbstract); |
| if (superclass != null) clazz.addInherited(superclass); |