@@ -26,14 +26,14 @@ final SOURCE_LIGHT_DOM_KEY = new Key(SourceLightDom);
26
26
final TEMPLATE_LOADER_KEY = new Key (TemplateLoader );
27
27
final SHADOW_ROOT_KEY = new Key (ShadowRoot );
28
28
29
- final int NO_CONSTRUCTION = 0 ;
29
+ const int _NO_CONSTRUCTION = 0 ;
30
30
31
31
// Maximum parent directive injectors that would be traversed.
32
- final int MAX_TREE_DEPTH = 1 << 30 ;
32
+ const int _MAX_TREE_DEPTH = 1 << 30 ;
33
33
34
34
// Maximum number of concurrent constructions a directive injector would
35
35
// support before throwing an error.
36
- final int MAX_CONSTRUCTION_DEPTH = 50 ;
36
+ const int _MAX_CONSTRUCTION_DEPTH = 50 ;
37
37
38
38
const int VISIBILITY_LOCAL = - 1 ;
39
39
const int VISIBILITY_DIRECT_CHILD = - 2 ;
@@ -114,7 +114,7 @@ class DirectiveInjector implements DirectiveBinder {
114
114
, COMPONENT_DIRECTIVE_INJECTOR_KEY
115
115
, KEEP_ME_LAST
116
116
];
117
-
117
+
118
118
final DirectiveInjector _parent;
119
119
final Injector _appInjector;
120
120
final Node _node;
@@ -168,7 +168,7 @@ class DirectiveInjector implements DirectiveBinder {
168
168
: _parent = parent,
169
169
_appInjector = appInjector,
170
170
_view = view == null && parent != null ? parent._view : view,
171
- _constructionDepth = NO_CONSTRUCTION ;
171
+ _constructionDepth = _NO_CONSTRUCTION ;
172
172
173
173
DirectiveInjector ._default (this ._parent, this ._appInjector)
174
174
: _node = null ,
@@ -177,7 +177,7 @@ class DirectiveInjector implements DirectiveBinder {
177
177
scope = null ,
178
178
_view = null ,
179
179
_animate = null ,
180
- _constructionDepth = NO_CONSTRUCTION ;
180
+ _constructionDepth = _NO_CONSTRUCTION ;
181
181
182
182
void bind (key, {dynamic toValue: DEFAULT_VALUE ,
183
183
Function toFactory: DEFAULT_VALUE ,
@@ -257,7 +257,7 @@ class DirectiveInjector implements DirectiveBinder {
257
257
switch (visType) {
258
258
case VISIBILITY_LOCAL : return 0 ;
259
259
case VISIBILITY_DIRECT_CHILD : return 1 ;
260
- case VISIBILITY_CHILDREN : return MAX_TREE_DEPTH ;
260
+ case VISIBILITY_CHILDREN : return _MAX_TREE_DEPTH ;
261
261
default : throw null ;
262
262
}
263
263
}
@@ -322,11 +322,11 @@ class DirectiveInjector implements DirectiveBinder {
322
322
}
323
323
324
324
dynamic _new (Key k, List <Key > paramKeys, Function fn) {
325
- if (_constructionDepth > MAX_CONSTRUCTION_DEPTH ) {
326
- _constructionDepth = NO_CONSTRUCTION ;
327
- throw new DiCircularDependencyError (k);
325
+ if (_constructionDepth > _MAX_CONSTRUCTION_DEPTH ) {
326
+ _constructionDepth = _NO_CONSTRUCTION ;
327
+ throw new _CircularDependencyError (k);
328
328
}
329
- bool isFirstConstruction = (_constructionDepth++ == NO_CONSTRUCTION );
329
+ bool isFirstConstruction = (_constructionDepth++ == _NO_CONSTRUCTION );
330
330
var oldTag = _TAG_GET .makeCurrent ();
331
331
int size = paramKeys.length;
332
332
var obj;
@@ -375,7 +375,7 @@ class DirectiveInjector implements DirectiveBinder {
375
375
}
376
376
}
377
377
oldTag.makeCurrent ();
378
- if (isFirstConstruction) _constructionDepth = NO_CONSTRUCTION ;
378
+ if (isFirstConstruction) _constructionDepth = _NO_CONSTRUCTION ;
379
379
return obj;
380
380
}
381
381
@@ -433,7 +433,7 @@ class TemplateDirectiveInjector extends DirectiveInjector {
433
433
if (_destLightDom != null ) _destLightDom.addViewPort (viewPort);
434
434
return viewPort;
435
435
}
436
-
436
+
437
437
}
438
438
439
439
class ComponentDirectiveInjector extends DirectiveInjector {
@@ -478,8 +478,8 @@ class ComponentDirectiveInjector extends DirectiveInjector {
478
478
479
479
// For efficiency we run through the maximum resolving depth and unwind
480
480
// instead of setting 'resolving' key per type.
481
- class DiCircularDependencyError extends ResolvingError {
482
- DiCircularDependencyError ( Key key) : super (key);
481
+ class _CircularDependencyError extends CircularDependencyError {
482
+ _CircularDependencyError ( key) : super (key);
483
483
484
484
// strips the cyclical part of the chain.
485
485
List <Key > get stripCycle {
@@ -494,6 +494,12 @@ class DiCircularDependencyError extends ResolvingError {
494
494
return rkeys;
495
495
}
496
496
497
- String get resolveChain => stripCycle.join (' -> ' );
498
- String toString () => "circular dependency (${resolveChain })" ;
497
+ String get resolveChain {
498
+ StringBuffer buffer = new StringBuffer ()
499
+ ..write ("(resolving " )
500
+ ..write (stripCycle.join (' -> ' ))
501
+ ..write (")" );
502
+ return buffer.toString ();
503
+ }
504
+
499
505
}
0 commit comments