1
1
library angular.core_dynamic;
2
2
3
3
import 'dart:mirrors' ;
4
- import 'package:angular/core/annotation .dart' ;
4
+ import 'package:angular/core/annotation_src .dart' ;
5
5
import 'package:angular/core/registry.dart' ;
6
6
7
7
export 'package:angular/core/registry.dart' show
8
8
MetadataExtractor;
9
9
10
- var _fieldMetadataCache = new Map <Type , Map <String , AttrFieldAnnotation >>();
10
+ var _fieldMetadataCache = new Map <Type , Map <String , AbstractNgFieldAnnotation >>();
11
11
12
12
class DynamicMetadataExtractor implements MetadataExtractor {
13
13
final _fieldAnnotations = [
@@ -30,38 +30,38 @@ class DynamicMetadataExtractor implements MetadataExtractor {
30
30
}
31
31
32
32
map (Type type, obj) {
33
- if (obj is NgAnnotation ) {
33
+ if (obj is AbstractNgAnnotation ) {
34
34
return mapDirectiveAnnotation (type, obj);
35
35
} else {
36
36
return obj;
37
37
}
38
38
}
39
39
40
- NgAnnotation mapDirectiveAnnotation (Type type, NgAnnotation annotation) {
40
+ AbstractNgAnnotation mapDirectiveAnnotation (Type type, AbstractNgAnnotation annotation) {
41
41
var match;
42
42
var fieldMetadata = fieldMetadataExtractor (type);
43
43
if (fieldMetadata.isNotEmpty) {
44
44
var newMap = annotation.map == null ? {} : new Map .from (annotation.map);
45
- fieldMetadata.forEach ((String fieldName, AttrFieldAnnotation ann) {
45
+ fieldMetadata.forEach ((String fieldName, AbstractNgFieldAnnotation ann) {
46
46
var attrName = ann.attrName;
47
47
if (newMap.containsKey (attrName)) {
48
48
throw 'Mapping for attribute $attrName is already defined (while '
49
49
'processing annottation for field $fieldName of $type )' ;
50
50
}
51
- newMap[attrName] = '${ann . mappingSpec }$fieldName ' ;
51
+ newMap[attrName] = '${mappingSpec ( ann ) }$fieldName ' ;
52
52
});
53
- annotation = annotation. cloneWithNewMap (newMap);
53
+ annotation = cloneWithNewMap (annotation, newMap);
54
54
}
55
55
return annotation;
56
56
}
57
57
58
58
59
- Map <String , AttrFieldAnnotation > fieldMetadataExtractor (Type type) =>
59
+ Map <String , AbstractNgFieldAnnotation > fieldMetadataExtractor (Type type) =>
60
60
_fieldMetadataCache.putIfAbsent (type, () => _fieldMetadataExtractor (type));
61
61
62
- Map <String , AttrFieldAnnotation > _fieldMetadataExtractor (Type type) {
62
+ Map <String , AbstractNgFieldAnnotation > _fieldMetadataExtractor (Type type) {
63
63
ClassMirror cm = reflectType (type);
64
- final fields = < String , AttrFieldAnnotation > {};
64
+ final fields = < String , AbstractNgFieldAnnotation > {};
65
65
cm.declarations.forEach ((Symbol name, DeclarationMirror decl) {
66
66
if (decl is VariableMirror ||
67
67
decl is MethodMirror && (decl.isGetter || decl.isSetter)) {
@@ -76,7 +76,7 @@ class DynamicMetadataExtractor implements MetadataExtractor {
76
76
throw 'Attribute annotation for $fieldName is defined more '
77
77
'than once in $type ' ;
78
78
}
79
- fields[fieldName] = meta.reflectee as AttrFieldAnnotation ;
79
+ fields[fieldName] = meta.reflectee as AbstractNgFieldAnnotation ;
80
80
}
81
81
});
82
82
}
0 commit comments