style(reflector): formatting
This commit is contained in:
parent
187c4aa33c
commit
7d566adea0
@ -154,7 +154,6 @@ class _SyncInjectorStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class _AsyncInjectorStrategy {
|
class _AsyncInjectorStrategy {
|
||||||
constructor(injector:Injector) {
|
constructor(injector:Injector) {
|
||||||
this.injector = injector;
|
this.injector = injector;
|
||||||
@ -229,7 +228,6 @@ class _AsyncInjectorStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function _flattenBindings(bindings:List) {
|
function _flattenBindings(bindings:List) {
|
||||||
var res = {};
|
var res = {};
|
||||||
ListWrapper.forEach(bindings, function (b) {
|
ListWrapper.forEach(bindings, function (b) {
|
||||||
|
@ -37,12 +37,16 @@ class Reflector {
|
|||||||
|
|
||||||
if (inject != null) {
|
if (inject != null) {
|
||||||
return new Dependency(Key.get(inject.token), false, false);
|
return new Dependency(Key.get(inject.token), false, false);
|
||||||
|
|
||||||
} else if (injectFuture != null) {
|
} else if (injectFuture != null) {
|
||||||
return new Dependency(Key.get(injectFuture.token), true, false);
|
return new Dependency(Key.get(injectFuture.token), true, false);
|
||||||
|
|
||||||
} else if (injectLazy != null) {
|
} else if (injectLazy != null) {
|
||||||
return new Dependency(Key.get(injectLazy.token), false, true);
|
return new Dependency(Key.get(injectLazy.token), false, true);
|
||||||
|
|
||||||
} else if (p.type.qualifiedName != #dynamic) {
|
} else if (p.type.qualifiedName != #dynamic) {
|
||||||
return new Dependency(Key.get(p.type.reflectedType), false, false);
|
return new Dependency(Key.get(p.type.reflectedType), false, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new NoAnnotationError(type);
|
throw new NoAnnotationError(type);
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,15 @@ import {ddescribe, describe, it, iit, xit, expect, beforeEach} from 'test_lib/te
|
|||||||
import {Injector, Inject, InjectFuture, bind, Key} from 'di/di';
|
import {Injector, Inject, InjectFuture, bind, Key} from 'di/di';
|
||||||
import {Future, FutureWrapper} from 'facade/async';
|
import {Future, FutureWrapper} from 'facade/async';
|
||||||
|
|
||||||
class UserList {}
|
class UserList {
|
||||||
|
}
|
||||||
|
|
||||||
function fetchUsers() {
|
function fetchUsers() {
|
||||||
return FutureWrapper.value(new UserList());
|
return FutureWrapper.value(new UserList());
|
||||||
}
|
}
|
||||||
|
|
||||||
class SynchronousUserList {}
|
class SynchronousUserList {
|
||||||
|
}
|
||||||
|
|
||||||
class UserController {
|
class UserController {
|
||||||
constructor(list:UserList) {
|
constructor(list:UserList) {
|
||||||
@ -107,7 +109,9 @@ export function main () {
|
|||||||
it('should show the full path when error happens in a constructor', function (done) {
|
it('should show the full path when error happens in a constructor', function (done) {
|
||||||
var injector = new Injector([
|
var injector = new Injector([
|
||||||
UserController,
|
UserController,
|
||||||
bind(UserList).toAsyncFactory([], function(){throw "Broken UserList";})
|
bind(UserList).toAsyncFactory([], function () {
|
||||||
|
throw "Broken UserList";
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var future = injector.asyncGet(UserController);
|
var future = injector.asyncGet(UserController);
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
import {describe, ddescribe, it, iit, expect, beforeEach} from 'test_lib/test_lib';
|
import {describe, ddescribe, it, iit, expect, beforeEach} from 'test_lib/test_lib';
|
||||||
import {Injector, Inject, InjectLazy, bind} from 'di/di';
|
import {Injector, Inject, InjectLazy, bind} from 'di/di';
|
||||||
|
|
||||||
class Engine {}
|
class Engine {
|
||||||
|
}
|
||||||
|
|
||||||
class BrokenEngine {
|
class BrokenEngine {
|
||||||
constructor() {
|
constructor() {
|
||||||
throw "Broken Engine";
|
throw "Broken Engine";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class DashboardSoftware {}
|
|
||||||
|
class DashboardSoftware {
|
||||||
|
}
|
||||||
|
|
||||||
class Dashboard {
|
class Dashboard {
|
||||||
constructor(software: DashboardSoftware) {}
|
constructor(software: DashboardSoftware) {}
|
||||||
}
|
}
|
||||||
class TurboEngine extends Engine{}
|
|
||||||
|
class TurboEngine extends Engine {
|
||||||
|
}
|
||||||
|
|
||||||
class Car {
|
class Car {
|
||||||
constructor(engine:Engine) {
|
constructor(engine:Engine) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user