@@ -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;
@@ -323,8 +323,8 @@ class DirectiveInjector implements DirectiveBinder {
323
323
324
324
dynamic _new (Key k, List <Key > paramKeys, Function fn) {
325
325
if (_constructionDepth > MAX_CONSTRUCTION_DEPTH ) {
326
- _constructionDepth = NO_CONSTRUCTION ;
327
- throw new DiCircularDependencyError (key );
326
+ _constructionDepth = 0 ;
327
+ throw new _CircularDependencyError (k );
328
328
}
329
329
bool isFirstConstruction = (_constructionDepth++ == NO_CONSTRUCTION );
330
330
var oldTag = _TAG_GET .makeCurrent ();
@@ -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) : 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