Skip to content

Commit b9d03e6

Browse files
committed
refactor(di): move Dependency from key.js to binding.js
1 parent a9896ed commit b9d03e6

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

modules/di/src/binding.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
import {Type, bool} from 'facade/lang';
1+
import {FIELD, Type, bool} from 'facade/lang';
22
import {List, MapWrapper, ListWrapper} from 'facade/collection';
33
import {reflector} from './reflector';
4-
import {Key, Dependency} from './key';
4+
import {Key} from './key';
55

6+
@FIELD('final key:Key')
7+
@FIELD('final asFuture:bool')
8+
@FIELD('final lazy:bool')
9+
export class Dependency {
10+
constructor(key:Key, asFuture:bool, lazy:bool) {
11+
this.key = key;
12+
this.asFuture = asFuture;
13+
this.lazy = lazy;
14+
}
15+
}
616
export class Binding {
717
constructor(key:Key, factory:Function, dependencies:List, providedAsFuture:bool) {
818
this.key = key;

modules/di/src/key.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@ import {FIELD, int, bool} from 'facade/lang';
44
var _allKeys = {};
55
var _id:int = 0;
66

7-
//TODO: vsavkin: move to binding once cyclic deps are supported
8-
@FIELD('final key:Key')
9-
@FIELD('final asFuture:bool')
10-
@FIELD('final lazy:bool')
11-
export class Dependency {
12-
constructor(key:Key, asFuture:bool, lazy:bool) {
13-
this.key = key;
14-
this.asFuture = asFuture;
15-
this.lazy = lazy;
16-
}
17-
}
18-
197
@FIELD('final token')
208
@FIELD('final id:int')
219
export class Key {

modules/di/src/reflector.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ library facade.di.reflector;
22

33
import 'dart:mirrors';
44
import 'annotations.dart' show Inject, InjectFuture, InjectLazy;
5-
import 'key.dart' show Key, Dependency;
5+
import 'key.dart' show Key;
6+
import 'binding.dart' show Dependency;
67
import 'exceptions.dart' show NoAnnotationError;
78

89
class Reflector {

modules/di/src/reflector.es6

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {Type, isPresent} from 'facade/lang';
22
import {List} from 'facade/collection';
33
import {Inject, InjectFuture, InjectLazy} from './annotations';
4-
import {Dependency, Key} from './key';
4+
import {Key} from './key';
5+
import {Dependency} from './binding';
56
import {NoAnnotationError} from './exceptions';
67

78
class Reflector {

0 commit comments

Comments
 (0)