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

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

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 17985f893b590e645e3e5d49e4a95336be795abc..9d66de3ed4f748fcf1358ed716e9d7c8a7ba610e 100644
--- a/third_party/pkg/angular/lib/core/registry.dart
+++ b/third_party/pkg/angular/lib/core/registry.dart
@@ -1,11 +1,13 @@
-part of angular.core;
+library angular.core.registry;
+
+import 'package:di/di.dart' show Injector;
abstract class AnnotationMap<K> {
final Map<K, Type> _map = {};
AnnotationMap(Injector injector, MetadataExtractor extractMetadata) {
injector.types.forEach((type) {
- var meta = extractMetadata(type)
+ extractMetadata(type)
.where((annotation) => annotation is K)
.forEach((annotation) {
_map[annotation] = type;
@@ -19,10 +21,12 @@ abstract class AnnotationMap<K> {
return value;
}
- forEach(fn(K, Type)) => _map.forEach(fn);
+ void forEach(fn(K, Type)) {
+ _map.forEach(fn);
+ }
List<K> annotationsFor(Type type) {
- var res = <K>[];
+ final res = <K>[];
forEach((ann, annType) {
if (annType == type) res.add(ann);
});
@@ -35,7 +39,7 @@ abstract class AnnotationsMap<K> {
AnnotationsMap(Injector injector, MetadataExtractor extractMetadata) {
injector.types.forEach((type) {
- var meta = extractMetadata(type)
+ extractMetadata(type)
.where((annotation) => annotation is K)
.forEach((annotation) {
map.putIfAbsent(annotation, () => []).add(type);
@@ -49,7 +53,7 @@ abstract class AnnotationsMap<K> {
return value;
}
- forEach(fn(K, Type)) {
+ void forEach(fn(K, Type)) {
map.forEach((annotation, types) {
types.forEach((type) {
fn(annotation, type);
@@ -66,13 +70,6 @@ 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);
- }
+abstract class MetadataExtractor {
+ Iterable call(Type type);
}
« no previous file with comments | « third_party/pkg/angular/lib/core/parser/utils.dart ('k') | third_party/pkg/angular/lib/core/registry_dynamic.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698