fix benchmarks

This commit is contained in:
vsavkin
2015-10-08 09:57:10 -07:00
parent 8b725c77fd
commit d63f3c123e
17 changed files with 36 additions and 57 deletions

View File

@ -255,30 +255,26 @@ export class Binding {
* expect(injector.get('message')).toEqual('Hello');
* ```
*/
export abstract class ResolvedBinding {
export interface ResolvedBinding {
/**
* A key, usually a `Type`.
*/
public key: Key;
key: Key;
/**
* Factory function which can return an instance of an object represented by a key.
*/
public resolvedFactories: ResolvedFactory[];
resolvedFactories: ResolvedFactory[];
/**
* Indicates if the binding is a multi-binding or a regular binding.
*/
public multiBinding: boolean;
multiBinding: boolean;
}
export class ResolvedBinding_ extends ResolvedBinding {
constructor(key: Key, resolvedFactories: ResolvedFactory[], multiBinding: boolean) {
super();
this.key = key;
this.resolvedFactories = resolvedFactories;
this.multiBinding = multiBinding;
}
export class ResolvedBinding_ implements ResolvedBinding {
constructor(public key: Key, public resolvedFactories: ResolvedFactory[],
public multiBinding: boolean) {}
get resolvedFactory(): ResolvedFactory { return this.resolvedFactories[0]; }
}

View File

@ -134,17 +134,7 @@ export class CyclicDependencyError extends AbstractBindingError {
* }
* ```
*/
export abstract class InstantiationError extends WrappedException {
constructor(message, originalException, originalStack, context) {
super(message, originalException, originalStack, context);
}
abstract addKey(injector: Injector, key: Key): void;
get wrapperMessage(): string { return unimplemented(); };
get causeKey(): Key { return unimplemented(); };
get context() { return unimplemented(); };
}
export class InstantiationError_ extends InstantiationError {
export class InstantiationError extends WrappedException {
/** @internal */
keys: Key[];

View File

@ -13,7 +13,6 @@ import {
NoBindingError,
CyclicDependencyError,
InstantiationError,
InstantiationError_,
InvalidBindingError,
OutOfBoundsError,
MixingMultiBindingsWithRegularBindings
@ -866,7 +865,7 @@ export class Injector {
break;
}
} catch (e) {
throw new InstantiationError_(this, e, e.stack, binding.key);
throw new InstantiationError(this, e, e.stack, binding.key);
}
return obj;
}