Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: third_party/pkg/angular/lib/core/registry.dart

Issue 176943008: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 573ba8f4ebbaaa94a046cdcd47cb64225c7aa191..17985f893b590e645e3e5d49e4a95336be795abc 100644
--- a/third_party/pkg/angular/lib/core/registry.dart
+++ b/third_party/pkg/angular/lib/core/registry.dart
@@ -6,18 +6,16 @@ abstract class AnnotationMap<K> {
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;
}
@@ -26,37 +24,33 @@ abstract class AnnotationMap<K> {
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);
});
@@ -66,9 +60,7 @@ abstract class AnnotationsMap<K> {
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;
}
@@ -77,8 +69,8 @@ abstract class AnnotationsMap<K> {
@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);

Powered by Google App Engine
This is Rietveld 408576698