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

Unified Diff: pkg/docgen/lib/docgen.dart

Issue 63483002: Fix some users of removed mirror API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/docgen/test/single_library_test.dart » ('j') | pkg/docgen/test/single_library_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | pkg/docgen/test/single_library_test.dart » ('j') | pkg/docgen/test/single_library_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698