Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 45bb8c6

Browse files
committed
doc(annotation): added documentation to annotations library.
1 parent b33c16b commit 45bb8c6

25 files changed

+650
-598
lines changed

lib/core/annotation.dart

Lines changed: 17 additions & 532 deletions
Large diffs are not rendered by default.

lib/core/annotation_src.dart

Lines changed: 567 additions & 0 deletions
Large diffs are not rendered by default.

lib/core/registry_dynamic.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
library angular.core_dynamic;
22

33
import 'dart:mirrors';
4-
import 'package:angular/core/annotation.dart';
4+
import 'package:angular/core/annotation_src.dart';
55
import 'package:angular/core/registry.dart';
66

77
export 'package:angular/core/registry.dart' show
88
MetadataExtractor;
99

10-
var _fieldMetadataCache = new Map<Type, Map<String, AttrFieldAnnotation>>();
10+
var _fieldMetadataCache = new Map<Type, Map<String, AbstractNgFieldAnnotation>>();
1111

1212
class DynamicMetadataExtractor implements MetadataExtractor {
1313
final _fieldAnnotations = [
@@ -30,38 +30,38 @@ class DynamicMetadataExtractor implements MetadataExtractor {
3030
}
3131

3232
map(Type type, obj) {
33-
if (obj is NgAnnotation) {
33+
if (obj is AbstractNgAnnotation) {
3434
return mapDirectiveAnnotation(type, obj);
3535
} else {
3636
return obj;
3737
}
3838
}
3939

40-
NgAnnotation mapDirectiveAnnotation(Type type, NgAnnotation annotation) {
40+
AbstractNgAnnotation mapDirectiveAnnotation(Type type, AbstractNgAnnotation annotation) {
4141
var match;
4242
var fieldMetadata = fieldMetadataExtractor(type);
4343
if (fieldMetadata.isNotEmpty) {
4444
var newMap = annotation.map == null ? {} : new Map.from(annotation.map);
45-
fieldMetadata.forEach((String fieldName, AttrFieldAnnotation ann) {
45+
fieldMetadata.forEach((String fieldName, AbstractNgFieldAnnotation ann) {
4646
var attrName = ann.attrName;
4747
if (newMap.containsKey(attrName)) {
4848
throw 'Mapping for attribute $attrName is already defined (while '
4949
'processing annottation for field $fieldName of $type)';
5050
}
51-
newMap[attrName] = '${ann.mappingSpec}$fieldName';
51+
newMap[attrName] = '${mappingSpec(ann)}$fieldName';
5252
});
53-
annotation = annotation.cloneWithNewMap(newMap);
53+
annotation = cloneWithNewMap(annotation, newMap);
5454
}
5555
return annotation;
5656
}
5757

5858

59-
Map<String, AttrFieldAnnotation> fieldMetadataExtractor(Type type) =>
59+
Map<String, AbstractNgFieldAnnotation> fieldMetadataExtractor(Type type) =>
6060
_fieldMetadataCache.putIfAbsent(type, () => _fieldMetadataExtractor(type));
6161

62-
Map<String, AttrFieldAnnotation> _fieldMetadataExtractor(Type type) {
62+
Map<String, AbstractNgFieldAnnotation> _fieldMetadataExtractor(Type type) {
6363
ClassMirror cm = reflectType(type);
64-
final fields = <String, AttrFieldAnnotation>{};
64+
final fields = <String, AbstractNgFieldAnnotation>{};
6565
cm.declarations.forEach((Symbol name, DeclarationMirror decl) {
6666
if (decl is VariableMirror ||
6767
decl is MethodMirror && (decl.isGetter || decl.isSetter)) {
@@ -76,7 +76,7 @@ class DynamicMetadataExtractor implements MetadataExtractor {
7676
throw 'Attribute annotation for $fieldName is defined more '
7777
'than once in $type';
7878
}
79-
fields[fieldName] = meta.reflectee as AttrFieldAnnotation;
79+
fields[fieldName] = meta.reflectee as AbstractNgFieldAnnotation;
8080
}
8181
});
8282
}

lib/core_dom/common.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MappingParts {
1616
class DirectiveRef {
1717
final dom.Node element;
1818
final Type type;
19-
final NgAnnotation annotation;
19+
final AbstractNgAnnotation annotation;
2020
final String value;
2121
final mappings = new List<MappingParts>();
2222

lib/core_dom/directive_map.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
part of angular.core.dom_internal;
22

33
@NgInjectableService()
4-
class DirectiveMap extends AnnotationsMap<NgAnnotation> {
4+
class DirectiveMap extends AnnotationsMap<AbstractNgAnnotation> {
55
DirectiveSelectorFactory _directiveSelectorFactory;
66
DirectiveSelector _selector;
77
DirectiveSelector get selector {

lib/core_dom/element_binder.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ElementBinder {
5858
final bool hasTemplate = false;
5959

6060
bool get shouldCompileChildren =>
61-
childMode == NgAnnotation.COMPILE_CHILDREN;
61+
childMode == AbstractNgAnnotation.COMPILE_CHILDREN;
6262

6363
var _directiveCache;
6464
List<DirectiveRef> get _usableDirectiveRefs {
@@ -269,7 +269,7 @@ class ElementBinder {
269269
..factory(ElementProbe, (_) => probe);
270270

271271
directiveRefs.forEach((DirectiveRef ref) {
272-
NgAnnotation annotation = ref.annotation;
272+
AbstractNgAnnotation annotation = ref.annotation;
273273
var visibility = ref.annotation.visibility;
274274
if (ref.annotation is NgController) {
275275
scope = scope.createChild(new PrototypeMap(scope.context));

lib/core_dom/element_binder_builder.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ class ElementBinderBuilder {
3838
DirectiveRef component;
3939

4040
// Can be either COMPILE_CHILDREN or IGNORE_CHILDREN
41-
String childMode = NgAnnotation.COMPILE_CHILDREN;
41+
String childMode = AbstractNgAnnotation.COMPILE_CHILDREN;
4242

4343
ElementBinderBuilder(this._factory);
4444

4545
addDirective(DirectiveRef ref) {
4646
var annotation = ref.annotation;
4747
var children = annotation.children;
4848

49-
if (annotation.children == NgAnnotation.TRANSCLUDE_CHILDREN) {
49+
if (annotation.children == AbstractNgAnnotation.TRANSCLUDE_CHILDREN) {
5050
template = ref;
5151
} else if (annotation is NgComponent) {
5252
component = ref;
5353
} else {
5454
decorators.add(ref);
5555
}
5656

57-
if (annotation.children == NgAnnotation.IGNORE_CHILDREN) {
57+
if (annotation.children == AbstractNgAnnotation.IGNORE_CHILDREN) {
5858
childMode = annotation.children;
5959
}
6060

lib/core_dom/module_internal.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'dart:html' as dom;
77
import 'package:di/di.dart';
88
import 'package:perf_api/perf_api.dart';
99

10-
import 'package:angular/core/annotation.dart';
10+
import 'package:angular/core/annotation_src.dart';
1111
import 'package:angular/core/module_internal.dart';
1212
import 'package:angular/core/parser/parser.dart';
1313
import 'package:angular/core_dom/dom_util.dart' as util;

lib/core_dom/selector.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ part of angular.core.dom_internal;
2929
*/
3030
class _Directive {
3131
final Type type;
32-
final NgAnnotation annotation;
32+
final AbstractNgAnnotation annotation;
3333

3434
_Directive(this.type, this.annotation);
3535

@@ -38,7 +38,7 @@ class _Directive {
3838

3939

4040
class _ContainsSelector {
41-
final NgAnnotation annotation;
41+
final AbstractNgAnnotation annotation;
4242
final RegExp regexp;
4343

4444
_ContainsSelector(this.annotation, String regexp)
@@ -252,7 +252,7 @@ class DirectiveSelector {
252252
elementSelector = new _ElementSelector('');
253253
attrSelector = <_ContainsSelector>[];
254254
textSelector = <_ContainsSelector>[];
255-
_directives.forEach((NgAnnotation annotation, Type type) {
255+
_directives.forEach((AbstractNgAnnotation annotation, Type type) {
256256
var match;
257257
var selector = annotation.selector;
258258
List<_SelectorPart> selectorParts;

lib/directive/ng_if.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ abstract class _NgUnlessIfAttrDirectiveBase {
9090
* </div>
9191
*/
9292
@NgDirective(
93-
children: NgAnnotation.TRANSCLUDE_CHILDREN,
93+
children: AbstractNgAnnotation.TRANSCLUDE_CHILDREN,
9494
selector:'[ng-if]',
9595
map: const {'.': '=>condition'})
9696
class NgIf extends _NgUnlessIfAttrDirectiveBase {
@@ -151,7 +151,7 @@ class NgIf extends _NgUnlessIfAttrDirectiveBase {
151151
* </div>
152152
*/
153153
@NgDirective(
154-
children: NgAnnotation.TRANSCLUDE_CHILDREN,
154+
children: AbstractNgAnnotation.TRANSCLUDE_CHILDREN,
155155
selector:'[ng-unless]',
156156
map: const {'.': '=>condition'})
157157
class NgUnless extends _NgUnlessIfAttrDirectiveBase {

0 commit comments

Comments
 (0)