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

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

Issue 19708003: Catergorized classes to abstract, class, typedef, and error/exception (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 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') | no next file with comments »
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 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);
« no previous file with comments | « no previous file | pkg/docgen/test/single_library_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698