refactor(di): move Dependency from key.js to binding.js

This commit is contained in:
vsavkin 2014-10-09 10:55:18 -04:00
parent a9896ed391
commit b9d03e6635
4 changed files with 16 additions and 16 deletions

View File

@ -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 {List, MapWrapper, ListWrapper} from 'facade/collection';
import {reflector} from './reflector'; 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 { export class Binding {
constructor(key:Key, factory:Function, dependencies:List, providedAsFuture:bool) { constructor(key:Key, factory:Function, dependencies:List, providedAsFuture:bool) {
this.key = key; this.key = key;

View File

@ -4,18 +4,6 @@ import {FIELD, int, bool} from 'facade/lang';
var _allKeys = {}; var _allKeys = {};
var _id:int = 0; 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 token')
@FIELD('final id:int') @FIELD('final id:int')
export class Key { export class Key {

View File

@ -2,7 +2,8 @@ library facade.di.reflector;
import 'dart:mirrors'; import 'dart:mirrors';
import 'annotations.dart' show Inject, InjectFuture, InjectLazy; 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; import 'exceptions.dart' show NoAnnotationError;
class Reflector { class Reflector {

View File

@ -1,7 +1,8 @@
import {Type, isPresent} from 'facade/lang'; import {Type, isPresent} from 'facade/lang';
import {List} from 'facade/collection'; import {List} from 'facade/collection';
import {Inject, InjectFuture, InjectLazy} from './annotations'; import {Inject, InjectFuture, InjectLazy} from './annotations';
import {Dependency, Key} from './key'; import {Key} from './key';
import {Dependency} from './binding';
import {NoAnnotationError} from './exceptions'; import {NoAnnotationError} from './exceptions';
class Reflector { class Reflector {