From 5162b3c0ca3319fafde92fe8a71304faa00568d9 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Tue, 7 Oct 2014 10:42:27 -0400 Subject: [PATCH] refactor(reflector): cleanup --- modules/di/test/di/async_spec.js | 18 +++++++++--------- modules/facade/src/collection.dart | 12 +++--------- modules/facade/src/lang.es6 | 2 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/modules/di/test/di/async_spec.js b/modules/di/test/di/async_spec.js index 247a658c40..d23993de5f 100644 --- a/modules/di/test/di/async_spec.js +++ b/modules/di/test/di/async_spec.js @@ -36,7 +36,7 @@ export function main() { expect(p).toBeFuture(); }); - it('should return a future if the binding is sync', function () { + it('should return a future when the binding is sync', function () { var injector = new Injector([ SynchronousUserList ]); @@ -44,6 +44,14 @@ export function main() { expect(p).toBeFuture(); }); + it("should return a future when the binding is sync (from cache)", function () { + var injector = new Injector([ + UserList + ]); + expect(injector.get(UserList)).toBeAnInstanceOf(UserList); + expect(injector.asyncGet(UserList)).toBeFuture(); + }); + it('should return the injector', function (done) { var injector = new Injector([]); var p = injector.asyncGet(Injector); @@ -67,14 +75,6 @@ export function main() { }); }); - it("should return a future when the binding is sync from cache", function () { - var injector = new Injector([ - UserList - ]); - expect(injector.get(UserList)).toBeAnInstanceOf(UserList); - expect(injector.asyncGet(UserList)).toBeFuture(); - }); - it("should create only one instance (async + async)", function (done) { var injector = new Injector([ bind(UserList).toAsyncFactory([], fetchUsers) diff --git a/modules/facade/src/collection.dart b/modules/facade/src/collection.dart index 9b8a179474..c3d72659d0 100644 --- a/modules/facade/src/collection.dart +++ b/modules/facade/src/collection.dart @@ -24,15 +24,9 @@ class ListWrapper { static forEach(list, fn) { list.forEach(fn); } - static first(List list) { - return list.first; - } - static last(List list) { - return list.last; - } - static List reversed(List list) { - return list.reversed.toList(); - } + static first(List list) => list.first; + static last(List list) => list.last; + static List reversed(List list) => list.reversed.toList(); static void push(List l, e) { l.add(e); } } diff --git a/modules/facade/src/lang.es6 b/modules/facade/src/lang.es6 index 848b74d80e..89ac94fd21 100644 --- a/modules/facade/src/lang.es6 +++ b/modules/facade/src/lang.es6 @@ -19,7 +19,7 @@ export function isBlank(obj):bool{ return obj == undefined || obj == null; } -export function stringify(token) { +export function stringify(token):string { if (typeof token === 'string') { return token; }