Skip to content

Commit df09a7c

Browse files
committed
refactor(injector): add bool and int annotations
1 parent 971e31f commit df09a7c

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

modules/di/src/binding.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {Type} from 'facade/lang';
1+
import {Type, bool} from 'facade/lang';
22
import {List, MapWrapper, ListWrapper} from 'facade/collection';
33
import {Reflector} from './reflector';
44
import {Key, Dependency} from './key';
55

66
export class Binding {
7-
constructor(key:Key, factory:Function, dependencies:List, providedAsFuture) {
7+
constructor(key:Key, factory:Function, dependencies:List, providedAsFuture:bool) {
88
this.key = key;
99
this.factory = factory;
1010
this.dependencies = dependencies;

modules/di/src/injector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Map, List, MapWrapper, ListWrapper} from 'facade/collection';
22
import {Binding, BindingBuilder, bind} from './binding';
33
import {ProviderError, NoProviderError, InvalidBindingError,
44
AsyncBindingError, CyclicDependencyError, InstantiationError} from './exceptions';
5-
import {Type, isPresent, isBlank} from 'facade/lang';
5+
import {Type, isPresent, isBlank, bool} from 'facade/lang';
66
import {Future, FutureWrapper} from 'facade/async';
77
import {Key} from './key';
88

@@ -13,7 +13,7 @@ class _Waiting {
1313
this.future = future;
1414
}
1515
}
16-
function _isWaiting(obj) {
16+
function _isWaiting(obj):bool {
1717
return obj instanceof _Waiting;
1818
}
1919

@@ -62,7 +62,7 @@ export class Injector {
6262
return ListWrapper.createFixedSize(Key.numberOfKeys() + 1);
6363
}
6464

65-
_getByKey(key:Key, returnFuture, returnLazy) {
65+
_getByKey(key:Key, returnFuture:bool, returnLazy:bool) {
6666
if (returnLazy) {
6767
return () => this._getByKey(key, returnFuture, false);
6868
}

modules/di/src/key.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import {MapWrapper} from 'facade/collection';
2+
import {int, bool} from 'facade/lang';
23

34
var _allKeys = {};
4-
var _id = 0;
5+
var _id:int = 0;
56

67
//TODO: vsavkin: move to binding once cyclic deps are supported
78
export class Dependency {
8-
constructor(key:Key, asFuture, lazy){
9+
constructor(key:Key, asFuture:bool, lazy:bool){
910
this.key = key;
1011
this.asFuture = asFuture;
1112
this.lazy = lazy;
1213
}
1314
}
1415

1516
export class Key {
16-
constructor(token, id) {
17+
constructor(token, id:int) {
1718
this.token = token;
1819
this.id = id;
1920
}

modules/di/src/reflector.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class Reflector {
3838
}
3939

4040
if (isPresent(type)) {
41-
return this._createDependency(type, false);
41+
return this._createDependency(type, false, false);
4242
} else {
4343
throw new NoAnnotationError(constructedType);
4444
}

0 commit comments

Comments
 (0)