| Index: third_party/pkg/angular/lib/core/registry.dart
|
| ===================================================================
|
| --- third_party/pkg/angular/lib/core/registry.dart (revision 33054)
|
| +++ third_party/pkg/angular/lib/core/registry.dart (working copy)
|
| @@ -6,16 +6,18 @@
|
| AnnotationMap(Injector injector, MetadataExtractor extractMetadata) {
|
| injector.types.forEach((type) {
|
| var meta = extractMetadata(type)
|
| - .where((annotation) => annotation is K)
|
| - .forEach((annotation) {
|
| - _map[annotation] = type;
|
| - });
|
| + .where((annotation) => annotation is K)
|
| + .forEach((annotation) {
|
| + _map[annotation] = type;
|
| + });
|
| });
|
| }
|
|
|
| Type operator[](K annotation) {
|
| var value = _map[annotation];
|
| - if (value == null) throw 'No $annotation found!';
|
| + if (value == null) {
|
| + throw 'No $annotation found!';
|
| + }
|
| return value;
|
| }
|
|
|
| @@ -24,33 +26,37 @@
|
| List<K> annotationsFor(Type type) {
|
| var res = <K>[];
|
| forEach((ann, annType) {
|
| - if (annType == type) res.add(ann);
|
| + if (annType == type) {
|
| + res.add(ann);
|
| + }
|
| });
|
| return res;
|
| }
|
| }
|
|
|
| abstract class AnnotationsMap<K> {
|
| - final Map<K, List<Type>> map = {};
|
| + final Map<K, List<Type>> _map = {};
|
|
|
| AnnotationsMap(Injector injector, MetadataExtractor extractMetadata) {
|
| injector.types.forEach((type) {
|
| var meta = extractMetadata(type)
|
| - .where((annotation) => annotation is K)
|
| - .forEach((annotation) {
|
| - map.putIfAbsent(annotation, () => []).add(type);
|
| - });
|
| + .where((annotation) => annotation is K)
|
| + .forEach((annotation) {
|
| + _map.putIfAbsent(annotation, () => []).add(type);
|
| + });
|
| });
|
| }
|
|
|
| List operator[](K annotation) {
|
| - var value = map[annotation];
|
| - if (value == null) throw 'No $annotation found!';
|
| + var value = _map[annotation];
|
| + if (value == null) {
|
| + throw 'No $annotation found!';
|
| + }
|
| return value;
|
| }
|
|
|
| forEach(fn(K, Type)) {
|
| - map.forEach((annotation, types) {
|
| + _map.forEach((annotation, types) {
|
| types.forEach((type) {
|
| fn(annotation, type);
|
| });
|
| @@ -60,7 +66,9 @@
|
| List<K> annotationsFor(Type type) {
|
| var res = <K>[];
|
| forEach((ann, annType) {
|
| - if (annType == type) res.add(ann);
|
| + if (annType == type) {
|
| + res.add(ann);
|
| + }
|
| });
|
| return res;
|
| }
|
| @@ -69,8 +77,8 @@
|
|
|
| @NgInjectableService()
|
| class MetadataExtractor {
|
| +
|
| Iterable call(Type type) {
|
| - if (reflectType(type) is TypedefMirror) return [];
|
| var metadata = reflectClass(type).metadata;
|
| if (metadata == null) return [];
|
| return metadata.map((InstanceMirror im) => im.reflectee);
|
|
|