@@ -100,7 +100,7 @@ class DirectiveInjector implements DirectiveBinder {
100
100
, KEEP_ME_LAST
101
101
];
102
102
103
- final DirectiveInjector parent ;
103
+ final DirectiveInjector _parent ;
104
104
final Injector appInjector;
105
105
final Node _node;
106
106
final NodeAttrs _nodeAttrs;
@@ -122,6 +122,9 @@ class DirectiveInjector implements DirectiveBinder {
122
122
Key _key8 = null ; dynamic _obj8; List <Key > _pKeys8; Function _factory8;
123
123
Key _key9 = null ; dynamic _obj9; List <Key > _pKeys9; Function _factory9;
124
124
125
+ @Deprecated ("Deprecated. Use getFromParent instead." )
126
+ Object get parent => this ._parent;
127
+
125
128
static _toVisId (Visibility v) => identical (v, Visibility .LOCAL )
126
129
? VISIBILITY_LOCAL
127
130
: (identical (v, Visibility .CHILDREN ) ? VISIBILITY_CHILDREN : VISIBILITY_DIRECT_CHILD );
@@ -140,12 +143,12 @@ class DirectiveInjector implements DirectiveBinder {
140
143
141
144
static Binding _tempBinding = new Binding ();
142
145
143
- DirectiveInjector (parent, appInjector, this ._node, this ._nodeAttrs, this ._eventHandler ,
144
- this .scope, this ._animate)
146
+ DirectiveInjector (DirectiveInjector parent, Injector appInjector, this ._node, this ._nodeAttrs,
147
+ this ._eventHandler, this .scope, this ._animate)
145
148
: appInjector = appInjector,
146
- parent = parent == null ? new DefaultDirectiveInjector (appInjector) : parent;
149
+ _parent = parent == null ? new DefaultDirectiveInjector (appInjector) : parent;
147
150
148
- DirectiveInjector ._default (this .parent , this .appInjector)
151
+ DirectiveInjector ._default (this ._parent , this .appInjector)
149
152
: _node = null ,
150
153
_nodeAttrs = null ,
151
154
_eventHandler = null ,
@@ -193,6 +196,7 @@ class DirectiveInjector implements DirectiveBinder {
193
196
}
194
197
195
198
Object get (Type type) => getByKey (new Key (type));
199
+ Object getFromParent (Type type) => _parent.get (type);
196
200
197
201
Object getByKey (Key key) {
198
202
var oldTag = _TAG_GET .makeCurrent ();
@@ -205,6 +209,7 @@ class DirectiveInjector implements DirectiveBinder {
205
209
oldTag.makeCurrent ();
206
210
}
207
211
}
212
+ Object getFromParentByKey (Key key) => _parent.getByKey (key);
208
213
209
214
Object _getByKey (Key key) {
210
215
int uid = key.uid;
@@ -228,12 +233,12 @@ class DirectiveInjector implements DirectiveBinder {
228
233
} while (false );
229
234
switch (visType) {
230
235
case VISIBILITY_LOCAL : return appInjector.getByKey (k);
231
- case VISIBILITY_DIRECT_CHILD : return parent ._getDirectiveByKey (k, VISIBILITY_LOCAL , i);
232
- case VISIBILITY_CHILDREN : return parent ._getDirectiveByKey (k, VISIBILITY_CHILDREN , i);
236
+ case VISIBILITY_DIRECT_CHILD : return _parent ._getDirectiveByKey (k, VISIBILITY_LOCAL , i);
237
+ case VISIBILITY_CHILDREN : return _parent ._getDirectiveByKey (k, VISIBILITY_CHILDREN , i);
233
238
// SHADOW
234
- case VISIBILITY_COMPONENT_LOCAL : return parent ._getDirectiveByKey (k, VISIBILITY_LOCAL , i);
235
- case VISIBILITY_COMPONENT_DIRECT_CHILD : return parent ._getDirectiveByKey (k, VISIBILITY_DIRECT_CHILD , i);
236
- case VISIBILITY_COMPONENT_CHILDREN : return parent ._getDirectiveByKey (k, VISIBILITY_CHILDREN , i);
239
+ case VISIBILITY_COMPONENT_LOCAL : return _parent ._getDirectiveByKey (k, VISIBILITY_LOCAL , i);
240
+ case VISIBILITY_COMPONENT_DIRECT_CHILD : return _parent ._getDirectiveByKey (k, VISIBILITY_DIRECT_CHILD , i);
241
+ case VISIBILITY_COMPONENT_CHILDREN : return _parent ._getDirectiveByKey (k, VISIBILITY_CHILDREN , i);
237
242
default : throw null ;
238
243
}
239
244
}
@@ -265,7 +270,7 @@ class DirectiveInjector implements DirectiveBinder {
265
270
case ELEMENT_PROBE_KEY_ID : return elementProbe;
266
271
case NG_ELEMENT_KEY_ID : return ngElement;
267
272
case EVENT_HANDLER_KEY_ID : return _eventHandler;
268
- case CONTENT_PORT_KEY_ID : return parent ._getById (keyId);
273
+ case CONTENT_PORT_KEY_ID : return _parent ._getById (keyId);
269
274
default : new NoProviderError (_KEYS [keyId]);
270
275
}
271
276
}
@@ -324,7 +329,7 @@ class DirectiveInjector implements DirectiveBinder {
324
329
325
330
ElementProbe get elementProbe {
326
331
if (_elementProbe == null ) {
327
- ElementProbe parentProbe = parent is DirectiveInjector ? parent.elementProbe : null ;
332
+ ElementProbe parentProbe = _parent == null ? null : _parent.elementProbe ;
328
333
_elementProbe = new ElementProbe (parentProbe, _node, this , scope);
329
334
}
330
335
return _elementProbe;
@@ -355,7 +360,7 @@ class TemplateDirectiveInjector extends DirectiveInjector {
355
360
case VIEW_PORT_KEY_ID : return ((_viewPort) == null ) ?
356
361
_viewPort = new ViewPort (this , scope, _node, _animate) : _viewPort;
357
362
case BOUND_VIEW_FACTORY_KEY_ID : return (_boundViewFactory == null ) ?
358
- _boundViewFactory = _viewFactory.bind (this .parent ) : _boundViewFactory;
363
+ _boundViewFactory = _viewFactory.bind (_parent ) : _boundViewFactory;
359
364
default : return super ._getById (keyId);
360
365
}
361
366
}
@@ -411,8 +416,7 @@ class ShadowDomComponentDirectiveInjector extends ComponentDirectiveInjector {
411
416
412
417
ElementProbe get elementProbe {
413
418
if (_elementProbe == null ) {
414
- ElementProbe parentProbe =
415
- parent is DirectiveInjector ? parent.elementProbe : parent.getByKey (ELEMENT_PROBE_KEY );
419
+ ElementProbe parentProbe = _parent == null ? null : _parent.elementProbe;
416
420
_elementProbe = new ElementProbe (parentProbe, _shadowRoot, this , scope);
417
421
}
418
422
return _elementProbe;
@@ -427,7 +431,7 @@ class DefaultDirectiveInjector extends DirectiveInjector {
427
431
428
432
Object getByKey (Key key) => appInjector.getByKey (key);
429
433
_getDirectiveByKey (Key key, int visType, Injector i) =>
430
- parent == null ? i.getByKey (key) : parent ._getDirectiveByKey (key, visType, i);
434
+ _parent == null ? i.getByKey (key) : _parent ._getDirectiveByKey (key, visType, i);
431
435
_getById (int keyId) {
432
436
switch (keyId) {
433
437
case CONTENT_PORT_KEY_ID : return null ;
0 commit comments