Chromium Code Reviews| Index: pkg/docgen/lib/docgen.dart |
| diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart |
| index 58cf6c135858a5e7c34eec044c73fe5c50a672ea..209dd71ce944d63b47e8e6132380066d64708a2d 100644 |
| --- a/pkg/docgen/lib/docgen.dart |
| +++ b/pkg/docgen/lib/docgen.dart |
| @@ -360,22 +360,41 @@ Map<String, Map<String, Method>> _getMethods |
| */ |
| Map<String, Class> _getClasses(Map<String, ClassMirror> mirrorMap, |
| bool includePrivate) { |
| - var data = {}; |
| + |
| + var abstract = {}; |
| + var classes = {}; |
| + var typedefs = {}; |
| + var errors = {}; |
| + |
| mirrorMap.forEach((String mirrorName, ClassMirror mirror) { |
| if (includePrivate || !mirror.isPrivate) { |
| - _currentClass = mirror; |
| var superclass = (mirror.superclass != null) ? |
| mirror.superclass.qualifiedName : ''; |
| var interfaces = |
| mirror.superinterfaces.map((interface) => interface.qualifiedName); |
| - data[mirrorName] = new Class(mirrorName, superclass, mirror.isAbstract, |
| - mirror.isTypedef, _getComment(mirror), interfaces.toList(), |
| - _getVariables(mirror.variables, includePrivate), |
| + var clazz = new Class(mirrorName, superclass, _getComment(mirror), |
| + interfaces.toList(), _getVariables(mirror.variables, includePrivate), |
| _getMethods(mirror.methods, includePrivate), |
| _getAnnotations(mirror), mirror.qualifiedName); |
| + _currentClass = mirror; |
| + |
| + if (isError(mirror.qualifiedName)) { |
| + errors[mirrorName] = clazz; |
| + } else if (mirror.isTypedef) { |
| + typedefs[mirrorName] = clazz; |
| + } else if (mirror.isAbstract) { |
| + abstract[mirrorName] = clazz; |
| + } else if (mirror.isClass) { |
| + classes[mirrorName] = clazz; |
| + } else { |
| + throw new StateError('$mirrorName - no class tyle match. '); |
|
Bob Nystrom
2013/07/18 17:08:07
"tyle" -> "style".
Also, throw ArgumentError inst
|
| + } |
| } |
| }); |
| - return data; |
| + return {'abstract' : abstract, |
| + 'class' : classes, |
| + 'typedef' : typedefs, |
| + 'error' : errors}; |
|
Bob Nystrom
2013/07/18 17:08:07
A couple of style nits: no space before ":", and p
|
| } |
| /** |
| @@ -424,6 +443,11 @@ Map recurseMap(Map inputMap) { |
| return outputMap; |
| } |
| +bool isError(String qualifiedName) { |
| + return qualifiedName.toLowerCase().contains('error') || |
| + qualifiedName.toLowerCase().contains('exception'); |
| +} |
| + |
| /** |
| * A class representing all programming constructs, like library or class. |
| */ |
| @@ -489,15 +513,13 @@ class Class extends IndexableItem { |
| String name; |
| String superclass; |
| - bool isAbstract; |
| - bool isTypedef; |
| /// List of the meta annotations on the class. |
| List<String> annotations; |
| - Class(this.name, this.superclass, this.isAbstract, this.isTypedef, |
| - this.comment, this.interfaces, this.variables, this.methods, |
| - this.annotations, String qualifiedName) : super(qualifiedName) {} |
| + Class(this.name, this.superclass, this.comment, this.interfaces, |
| + this.variables, this.methods, this.annotations, |
| + String qualifiedName) : super(qualifiedName) {} |
| /// Generates a map describing the [Class] object. |
| Map toMap() { |
| @@ -505,8 +527,6 @@ class Class extends IndexableItem { |
| classMap['name'] = name; |
| classMap['comment'] = comment; |
| classMap['superclass'] = superclass; |
| - classMap['abstract'] = isAbstract.toString(); |
| - classMap['typedef'] = isTypedef.toString(); |
| classMap['implements'] = new List.from(interfaces); |
| classMap['variables'] = recurseMap(variables); |
| classMap['methods'] = recurseMap(methods); |