Skip to content

Commit 22d3a03

Browse files
committed
refactor(DirectiveInjector)
1 parent 3e51644 commit 22d3a03

6 files changed

+104
-107
lines changed

lib/core/annotation_src.dart

+21-30
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ abstract class DirectiveBinder {
66
bind(key, {Function toFactory, inject, Visibility visibility: Visibility.CHILDREN});
77
}
88

9-
typedef void DirectiveBinderFn(DirectiveBinder module);
9+
typedef void DirectiveBinderFn(DirectiveBinder binder);
1010

1111
RegExp _ATTR_NAME = new RegExp(r'\[([^\]]+)\]$');
1212

@@ -31,18 +31,18 @@ class Visibility {
3131
abstract class Directive {
3232

3333
/// The directive can only be injected to other directives on the same element.
34-
@deprecated // ('Use Visibility.LOCAL instead')
34+
@Deprecated('Use Visibility.LOCAL instead')
3535
static const Visibility LOCAL_VISIBILITY = Visibility.LOCAL;
3636

3737
/// The directive can be injected to other directives on the same or child elements.
38-
@deprecated// ('Use Visibility.CHILDREN instead')
38+
@Deprecated('Use Visibility.CHILDREN instead')
3939
static const Visibility CHILDREN_VISIBILITY = Visibility.CHILDREN;
4040

4141
/**
4242
* The directive on this element can only be injected to other directives
4343
* declared on elements which are direct children of the current element.
4444
*/
45-
@deprecated// ('Use Visibility.DIRECT_CHILD instead')
45+
@Deprecated('Use Visibility.DIRECT_CHILD instead')
4646
static const Visibility DIRECT_CHILDREN_VISIBILITY = Visibility.DIRECT_CHILD;
4747

4848
/**
@@ -90,26 +90,22 @@ abstract class Directive {
9090
static const String IGNORE_CHILDREN = 'ignore';
9191

9292
/**
93-
* A directive/component controller class can be injected into other
94-
* directives/components. This attribute controls whether the
95-
* controller is available to others.
93+
* A directive/component controller class can be injected into other directives/components. This
94+
* attribute controls whether the controller is available to others.
9695
*
97-
* * `local` [Directive.LOCAL_VISIBILITY] - the controller can be injected
98-
* into other directives / components on the same DOM element.
99-
* * `children` [Directive.CHILDREN_VISIBILITY] - the controller can be
100-
* injected into other directives / components on the same or child DOM
101-
* elements.
102-
* * `direct_children` [Directive.DIRECT_CHILDREN_VISIBILITY] - the
103-
* controller can be injected into other directives / components on the
104-
* direct children of the current DOM element.
96+
* * [Visibility.LOCAL] - the controller can be injected into other directives / components on the
97+
* same DOM element.
98+
* * [Visibility.CHILDREN] - the controller can be injected into other directives / components on
99+
* the same or child DOM elements.
100+
* * [Visibility.DIRECT_CHILD] - the controller can be injected into other directives / components
101+
* on the direct children of the current DOM element.
105102
*/
106103
final Visibility visibility;
107104

108105
/**
109-
* A directive/component class can publish types by using a factory
110-
* function to generate a module. The module is then installed into
111-
* the injector at that element. Any types declared in the module then
112-
* become available for injection.
106+
* A directive/component class can publish types by using a factory function to generate a module.
107+
* The module is then installed into the injector at that element. Any types declared in the
108+
* module then become available for injection.
113109
*
114110
* Example:
115111
*
@@ -121,11 +117,10 @@ abstract class Directive {
121117
* binder.bind(SomeTypeA, visibility: Directive.LOCAL_VISIBILITY);
122118
* }
123119
*
124-
* When specifying types, factories or values in the module, notice that
125-
* `Visibility` maps to:
126-
* * [Directive.LOCAL_VISIBILITY]
127-
* * [Directive.CHILDREN_VISIBILITY]
128-
* * [Directive.DIRECT_CHILDREN_VISIBILITY]
120+
* `visibility` is one of:
121+
* * [Visibility.LOCAL]
122+
* * [Visibility.CHILDREN] (default)
123+
* * [Visibility.DIRECT_CHILD]
129124
*/
130125
final DirectiveBinderFn module;
131126

@@ -263,10 +258,8 @@ class Component extends Directive {
263258
/**
264259
* Set the shadow root applyAuthorStyles property. See shadow-DOM
265260
* documentation for further details.
266-
*
267-
* This feature will be removed in Chrome 35.
268261
*/
269-
@deprecated
262+
@Deprecated('in Chrome 35')
270263
bool get applyAuthorStyles {
271264
if (!_applyAuthorStylesDeprecationWarningPrinted && _applyAuthorStyles == true) {
272265
print("WARNING applyAuthorStyles is deprecated in component $selector");
@@ -279,10 +272,8 @@ class Component extends Directive {
279272
/**
280273
* Set the shadow root resetStyleInheritance property. See shadow-DOM
281274
* documentation for further details.
282-
*
283-
* This feature will be removed in Chrome 35.
284275
*/
285-
@deprecated
276+
@Deprecated('in Chrome 35')
286277
bool get resetStyleInheritance {
287278
if (!_resetStyleInheritanceDeprecationWarningPrinted && _resetStyleInheritance == true) {
288279
print("WARNING resetStyleInheritance is deprecated in component $selector");

0 commit comments

Comments
 (0)