| Index: third_party/pkg/angular/lib/core/registry.dart
|
| diff --git a/third_party/pkg/angular/lib/core/registry.dart b/third_party/pkg/angular/lib/core/registry.dart
|
| index 39932a25625b6f09f8af3d227056d6af3a6dd5d5..573ba8f4ebbaaa94a046cdcd47cb64225c7aa191 100644
|
| --- a/third_party/pkg/angular/lib/core/registry.dart
|
| +++ b/third_party/pkg/angular/lib/core/registry.dart
|
| @@ -8,11 +8,6 @@ abstract class AnnotationMap<K> {
|
| var meta = extractMetadata(type)
|
| .where((annotation) => annotation is K)
|
| .forEach((annotation) {
|
| - if (_map.containsKey(annotation)) {
|
| - var annotationType = K;
|
| - throw "Duplicate annotation found: $annotationType: $annotation. " +
|
| - "Exisitng: ${_map[annotation]}; New: $type.";
|
| - }
|
| _map[annotation] = type;
|
| });
|
| });
|
| @@ -39,6 +34,47 @@ abstract class AnnotationMap<K> {
|
| }
|
| }
|
|
|
| +abstract class AnnotationsMap<K> {
|
| + 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);
|
| + });
|
| + });
|
| + }
|
| +
|
| + List operator[](K annotation) {
|
| + var value = _map[annotation];
|
| + if (value == null) {
|
| + throw 'No $annotation found!';
|
| + }
|
| + return value;
|
| + }
|
| +
|
| + forEach(fn(K, Type)) {
|
| + _map.forEach((annotation, types) {
|
| + types.forEach((type) {
|
| + fn(annotation, type);
|
| + });
|
| + });
|
| + }
|
| +
|
| + List<K> annotationsFor(Type type) {
|
| + var res = <K>[];
|
| + forEach((ann, annType) {
|
| + if (annType == type) {
|
| + res.add(ann);
|
| + }
|
| + });
|
| + return res;
|
| + }
|
| +}
|
| +
|
| +
|
| @NgInjectableService()
|
| class MetadataExtractor {
|
|
|
|
|