@@ -344,61 +344,38 @@ Map<String, Map<String, Method>> _getMethods
344
344
} else if (mirror.isRegularMethod) {
345
345
methods[mirrorName] = method;
346
346
} else {
347
- throw new ArgumentError ('$mirrorName - no method type match' );
347
+ throw new StateError ('${ mirror . qualifiedName } - no method type match' );
348
348
}
349
349
}
350
350
});
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};
358
356
}
359
357
360
358
/**
361
359
* Returns a map of [Class] objects constructed from inputted mirrors.
362
360
*/
363
361
Map <String , Class > _getClasses (Map <String , ClassMirror > mirrorMap,
364
362
bool includePrivate) {
365
-
366
- var abstract = {};
367
- var classes = {};
368
- var typedefs = {};
369
- var errors = {};
370
-
363
+ var data = {};
371
364
mirrorMap.forEach ((String mirrorName, ClassMirror mirror) {
372
365
if (includePrivate || ! mirror.isPrivate) {
366
+ _currentClass = mirror;
373
367
var superclass = (mirror.superclass != null ) ?
374
368
mirror.superclass.qualifiedName : '' ;
375
369
var interfaces =
376
370
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),
379
374
_getMethods (mirror.methods, includePrivate),
380
375
_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
- }
394
376
}
395
377
});
396
- return {
397
- 'abstract' : abstract ,
398
- 'class' : classes,
399
- 'typedef' : typedefs,
400
- 'error' : errors
401
- };
378
+ return data;
402
379
}
403
380
404
381
/**
@@ -447,11 +424,6 @@ Map recurseMap(Map inputMap) {
447
424
return outputMap;
448
425
}
449
426
450
- bool isError (String qualifiedName) {
451
- return qualifiedName.toLowerCase ().contains ('error' ) ||
452
- qualifiedName.toLowerCase ().contains ('exception' );
453
- }
454
-
455
427
/**
456
428
* A class representing all programming constructs, like library or class.
457
429
*/
@@ -517,20 +489,24 @@ class Class extends Indexable {
517
489
518
490
String name;
519
491
String superclass;
492
+ bool isAbstract;
493
+ bool isTypedef;
520
494
521
495
/// List of the meta annotations on the class.
522
496
List <String > annotations;
523
497
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) {}
527
501
528
502
/// Generates a map describing the [Class] object.
529
503
Map toMap () {
530
504
var classMap = {};
531
505
classMap['name' ] = name;
532
506
classMap['comment' ] = comment;
533
507
classMap['superclass' ] = superclass;
508
+ classMap['abstract' ] = isAbstract.toString ();
509
+ classMap['typedef' ] = isTypedef.toString ();
534
510
classMap['implements' ] = new List .from (interfaces);
535
511
classMap['variables' ] = recurseMap (variables);
536
512
classMap['methods' ] = recurseMap (methods);
0 commit comments