11import { ListWrapper , List } from 'angular2/src/facade/collection' ;
22import { stringify } from 'angular2/src/facade/lang' ;
3- import { Key } from './key' ;
43
54function findFirstClosedCycle ( keys :List ) {
65 var res = [ ] ;
@@ -31,14 +30,16 @@ export class ProviderError extends Error {
3130 keys :List ;
3231 constructResolvingMessage :Function ;
3332 message ;
34- constructor ( key :Key , constructResolvingMessage :Function ) {
33+ // TODO(tbosch): Can't do key:Key as this results in a circular dependency!
34+ constructor ( key , constructResolvingMessage :Function ) {
3535 super ( ) ;
3636 this . keys = [ key ] ;
3737 this . constructResolvingMessage = constructResolvingMessage ;
3838 this . message = this . constructResolvingMessage ( this . keys ) ;
3939 }
4040
41- addKey ( key :Key ) {
41+ // TODO(tbosch): Can't do key:Key as this results in a circular dependency!
42+ addKey ( key ) {
4243 ListWrapper . push ( this . keys , key ) ;
4344 this . message = this . constructResolvingMessage ( this . keys ) ;
4445 }
@@ -49,7 +50,8 @@ export class ProviderError extends Error {
4950}
5051
5152export class NoProviderError extends ProviderError {
52- constructor ( key :Key ) {
53+ // TODO(tbosch): Can't do key:Key as this results in a circular dependency!
54+ constructor ( key ) {
5355 super ( key , function ( keys :List ) {
5456 var first = stringify ( ListWrapper . first ( keys ) . token ) ;
5557 return `No provider for ${ first } !${ constructResolvingPath ( keys ) } ` ;
@@ -58,7 +60,8 @@ export class NoProviderError extends ProviderError {
5860}
5961
6062export class AsyncBindingError extends ProviderError {
61- constructor ( key :Key ) {
63+ // TODO(tbosch): Can't do key:Key as this results in a circular dependency!
64+ constructor ( key ) {
6265 super ( key , function ( keys :List ) {
6366 var first = stringify ( ListWrapper . first ( keys ) . token ) ;
6467 return `Cannot instantiate ${ first } synchronously. ` +
@@ -68,15 +71,17 @@ export class AsyncBindingError extends ProviderError {
6871}
6972
7073export class CyclicDependencyError extends ProviderError {
71- constructor ( key :Key ) {
74+ // TODO(tbosch): Can't do key:Key as this results in a circular dependency!
75+ constructor ( key ) {
7276 super ( key , function ( keys :List ) {
7377 return `Cannot instantiate cyclic dependency!${ constructResolvingPath ( keys ) } ` ;
7478 } ) ;
7579 }
7680}
7781
7882export class InstantiationError extends ProviderError {
79- constructor ( originalException , key :Key ) {
83+ // TODO(tbosch): Can't do key:Key as this results in a circular dependency!
84+ constructor ( originalException , key ) {
8085 super ( key , function ( keys :List ) {
8186 var first = stringify ( ListWrapper . first ( keys ) . token ) ;
8287 return `Error during instantiation of ${ first } !${ constructResolvingPath ( keys ) } .` +
0 commit comments