| Index: pkg/docgen/lib/src/models/annotation.dart
|
| diff --git a/pkg/docgen/lib/src/models/annotation.dart b/pkg/docgen/lib/src/models/annotation.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b3dec10f555e6d2ab6ff07381738927554c0167c
|
| --- /dev/null
|
| +++ b/pkg/docgen/lib/src/models/annotation.dart
|
| @@ -0,0 +1,31 @@
|
| +library docgen.models.annotation;
|
| +
|
| +import '../exports/mirrors_util.dart' as dart2js_util;
|
| +import '../exports/source_mirrors.dart';
|
| +
|
| +import '../library_helpers.dart';
|
| +
|
| +import 'library.dart';
|
| +import 'mirror_based.dart';
|
| +
|
| +/// Holds the name of the annotation, and its parameters.
|
| +class Annotation extends MirrorBased {
|
| + /// The class of this annotation.
|
| + final ClassMirror mirror;
|
| + final Library owningLibrary;
|
| + List<String> parameters;
|
| +
|
| + Annotation(InstanceMirror originalMirror, this.owningLibrary)
|
| + : mirror = originalMirror.type {
|
| + parameters = dart2js_util.variablesOf(originalMirror.type.declarations)
|
| + .where((e) => e.isFinal)
|
| + .map((e) => originalMirror.getField(e.simpleName).reflectee)
|
| + .where((e) => e != null)
|
| + .toList();
|
| + }
|
| +
|
| + Map toMap() => {
|
| + 'name': getDocgenObject(mirror, owningLibrary).docName,
|
| + 'parameters': parameters
|
| + };
|
| +}
|
|
|