Skip to content

Commit 242d978

Browse files
committed
"Reverting 25160"
BUG= Review URL: https://codereview.chromium.org//19638009 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25163 260f80e4-7a28-3924-810f-c04153c831b5
1 parent 624fb4c commit 242d978

File tree

2 files changed

+20
-48
lines changed

2 files changed

+20
-48
lines changed

pkg/docgen/lib/docgen.dart

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -344,61 +344,38 @@ Map<String, Map<String, Method>> _getMethods
344344
} else if (mirror.isRegularMethod) {
345345
methods[mirrorName] = method;
346346
} else {
347-
throw new ArgumentError('$mirrorName - no method type match');
347+
throw new StateError('${mirror.qualifiedName} - no method type match');
348348
}
349349
}
350350
});
351-
return {
352-
'setters': setters,
353-
'getters': getters,
354-
'constructors': constructors,
355-
'operators': operators,
356-
'methods': methods
357-
};
351+
return {'setters' : setters,
352+
'getters' : getters,
353+
'constructors' : constructors,
354+
'operators' : operators,
355+
'methods' : methods};
358356
}
359357

360358
/**
361359
* Returns a map of [Class] objects constructed from inputted mirrors.
362360
*/
363361
Map<String, Class> _getClasses(Map<String, ClassMirror> mirrorMap,
364362
bool includePrivate) {
365-
366-
var abstract = {};
367-
var classes = {};
368-
var typedefs = {};
369-
var errors = {};
370-
363+
var data = {};
371364
mirrorMap.forEach((String mirrorName, ClassMirror mirror) {
372365
if (includePrivate || !mirror.isPrivate) {
366+
_currentClass = mirror;
373367
var superclass = (mirror.superclass != null) ?
374368
mirror.superclass.qualifiedName : '';
375369
var interfaces =
376370
mirror.superinterfaces.map((interface) => interface.qualifiedName);
377-
var clazz = new Class(mirrorName, superclass, _getComment(mirror),
378-
interfaces.toList(), _getVariables(mirror.variables, includePrivate),
371+
data[mirrorName] = new Class(mirrorName, superclass, mirror.isAbstract,
372+
mirror.isTypedef, _getComment(mirror), interfaces.toList(),
373+
_getVariables(mirror.variables, includePrivate),
379374
_getMethods(mirror.methods, includePrivate),
380375
_getAnnotations(mirror), mirror.qualifiedName);
381-
_currentClass = mirror;
382-
383-
if (isError(mirror.qualifiedName)) {
384-
errors[mirrorName] = clazz;
385-
} else if (mirror.isTypedef) {
386-
typedefs[mirrorName] = clazz;
387-
} else if (mirror.isAbstract) {
388-
abstract[mirrorName] = clazz;
389-
} else if (mirror.isClass) {
390-
classes[mirrorName] = clazz;
391-
} else {
392-
throw new ArgumentError('$mirrorName - no class style match. ');
393-
}
394376
}
395377
});
396-
return {
397-
'abstract': abstract,
398-
'class': classes,
399-
'typedef': typedefs,
400-
'error': errors
401-
};
378+
return data;
402379
}
403380

404381
/**
@@ -447,11 +424,6 @@ Map recurseMap(Map inputMap) {
447424
return outputMap;
448425
}
449426

450-
bool isError(String qualifiedName) {
451-
return qualifiedName.toLowerCase().contains('error') ||
452-
qualifiedName.toLowerCase().contains('exception');
453-
}
454-
455427
/**
456428
* A class representing all programming constructs, like library or class.
457429
*/
@@ -517,20 +489,24 @@ class Class extends Indexable {
517489

518490
String name;
519491
String superclass;
492+
bool isAbstract;
493+
bool isTypedef;
520494

521495
/// List of the meta annotations on the class.
522496
List<String> annotations;
523497

524-
Class(this.name, this.superclass, this.comment, this.interfaces,
525-
this.variables, this.methods, this.annotations,
526-
String qualifiedName) : super(qualifiedName) {}
498+
Class(this.name, this.superclass, this.isAbstract, this.isTypedef,
499+
this.comment, this.interfaces, this.variables, this.methods,
500+
this.annotations, String qualifiedName) : super(qualifiedName) {}
527501

528502
/// Generates a map describing the [Class] object.
529503
Map toMap() {
530504
var classMap = {};
531505
classMap['name'] = name;
532506
classMap['comment'] = comment;
533507
classMap['superclass'] = superclass;
508+
classMap['abstract'] = isAbstract.toString();
509+
classMap['typedef'] = isTypedef.toString();
534510
classMap['implements'] = new List.from(interfaces);
535511
classMap['variables'] = recurseMap(variables);
536512
classMap['methods'] = recurseMap(methods);

pkg/docgen/test/single_library_test.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ main() {
5454
includePrivate: true);
5555
expect(library is Library, isTrue);
5656

57-
var classTypes = library.classes.values;
58-
expect(classTypes.every((e) => e is Map), isTrue);
59-
60-
var classes = [];
61-
classTypes.forEach((e) => classes.addAll(e.values));
57+
var classes = library.classes.values;
6258
expect(classes.every((e) => e is Class), isTrue);
6359

6460
var classMethodTypes = [];

0 commit comments

Comments
 (0)