refactor(injector): cleanup

This commit is contained in:
vsavkin 2014-10-07 10:03:06 -04:00
parent ea22cc4c7a
commit ab4f86a0cb
3 changed files with 11 additions and 8 deletions

View File

@ -6,11 +6,11 @@ import 'key.dart' show Key, Dependency;
import 'exceptions.dart' show NoAnnotationError;
class Reflector {
factoryFor(Type type) {
Function factoryFor(Type type) {
return _generateFactory(type);
}
convertToFactory(Function factory) {
Function convertToFactory(Function factory) {
return (args) => Function.apply(factory, args);
}
@ -22,7 +22,7 @@ class Reflector {
return (args) => create(name, args).reflectee;
}
dependencies(Type type) {
List<Dependency> dependencies(Type type) {
ClassMirror classMirror = reflectType(type);
MethodMirror ctor = classMirror.declarations[classMirror.simpleName];

View File

@ -34,7 +34,7 @@ export function main () {
expect(p).toBeFuture();
});
it('should return a future when if the binding is sync', function() {
it('should return a future if the binding is sync', function() {
var injector = new Injector([
SynchronousUserList
]);
@ -42,10 +42,13 @@ export function main () {
expect(p).toBeFuture();
});
it('should return the injector', function() {
it('should return the injector', function(done) {
var injector = new Injector([]);
var p = injector.asyncGet(Injector);
expect(p).toBeFuture();
p.then(function(injector) {
expect(injector).toBe(injector);
done();
});
});
it('should return a future when instantiating a sync binding ' +

View File

@ -30,8 +30,8 @@ class ListWrapper {
static last(List list) {
return list.last;
}
static reversed(List list) {
return list.reversed;
static List reversed(List list) {
return list.reversed.toList();
}
static void push(List l, e) { l.add(e); }
}