From b9d03e6635cbc79ef41802d1bc2dd8404c3f9c7b Mon Sep 17 00:00:00 2001 From: vsavkin Date: Thu, 9 Oct 2014 10:55:18 -0400 Subject: [PATCH] refactor(di): move Dependency from key.js to binding.js --- modules/di/src/binding.js | 14 ++++++++++++-- modules/di/src/key.js | 12 ------------ modules/di/src/reflector.dart | 3 ++- modules/di/src/reflector.es6 | 3 ++- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/di/src/binding.js b/modules/di/src/binding.js index 04b1050247..0e5082095c 100644 --- a/modules/di/src/binding.js +++ b/modules/di/src/binding.js @@ -1,8 +1,18 @@ -import {Type, bool} from 'facade/lang'; +import {FIELD, Type, bool} from 'facade/lang'; import {List, MapWrapper, ListWrapper} from 'facade/collection'; import {reflector} from './reflector'; -import {Key, Dependency} from './key'; +import {Key} from './key'; +@FIELD('final key:Key') +@FIELD('final asFuture:bool') +@FIELD('final lazy:bool') +export class Dependency { + constructor(key:Key, asFuture:bool, lazy:bool) { + this.key = key; + this.asFuture = asFuture; + this.lazy = lazy; + } +} export class Binding { constructor(key:Key, factory:Function, dependencies:List, providedAsFuture:bool) { this.key = key; diff --git a/modules/di/src/key.js b/modules/di/src/key.js index f464ce05f4..2677f612d1 100644 --- a/modules/di/src/key.js +++ b/modules/di/src/key.js @@ -4,18 +4,6 @@ import {FIELD, int, bool} from 'facade/lang'; var _allKeys = {}; var _id:int = 0; -//TODO: vsavkin: move to binding once cyclic deps are supported -@FIELD('final key:Key') -@FIELD('final asFuture:bool') -@FIELD('final lazy:bool') -export class Dependency { - constructor(key:Key, asFuture:bool, lazy:bool) { - this.key = key; - this.asFuture = asFuture; - this.lazy = lazy; - } -} - @FIELD('final token') @FIELD('final id:int') export class Key { diff --git a/modules/di/src/reflector.dart b/modules/di/src/reflector.dart index 32fd4e2c05..89ec160371 100644 --- a/modules/di/src/reflector.dart +++ b/modules/di/src/reflector.dart @@ -2,7 +2,8 @@ library facade.di.reflector; import 'dart:mirrors'; import 'annotations.dart' show Inject, InjectFuture, InjectLazy; -import 'key.dart' show Key, Dependency; +import 'key.dart' show Key; +import 'binding.dart' show Dependency; import 'exceptions.dart' show NoAnnotationError; class Reflector { diff --git a/modules/di/src/reflector.es6 b/modules/di/src/reflector.es6 index 1e9675cbfe..ae09f7cbfe 100644 --- a/modules/di/src/reflector.es6 +++ b/modules/di/src/reflector.es6 @@ -1,7 +1,8 @@ import {Type, isPresent} from 'facade/lang'; import {List} from 'facade/collection'; import {Inject, InjectFuture, InjectLazy} from './annotations'; -import {Dependency, Key} from './key'; +import {Key} from './key'; +import {Dependency} from './binding'; import {NoAnnotationError} from './exceptions'; class Reflector {