Skip to content

Commit

Permalink
Injector is just tracking scopes now, so might as well push that into…
Browse files Browse the repository at this point in the history
… AbstractModule
  • Loading branch information
groves committed Jan 13, 2011
1 parent 4d9bb2d commit f299471
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 47 deletions.
10 changes: 8 additions & 2 deletions src/main/as3/flashx/funk/ioc/AbstractModule.as
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ package flashx.funk.ioc {
import flashx.funk.ioc.error.BindingError

public class AbstractModule implements IModule {
private static const _scopes: Array = []
private const _map: Dictionary = new Dictionary

module_internal static function get currentScope(): IModule
{
return _scopes[_scopes.length - 1];
}

public function AbstractModule() {
}

Expand All @@ -45,10 +51,10 @@ package flashx.funk.ioc {
const binding: Binding = _map[klass]

try {
Injector.module_internal::pushScope(this)
_scopes.push(this);
return (null == binding) ? new klass : binding.getInstance()
} finally {
Injector.module_internal::popScope()
_scopes.pop();
}
}

Expand Down
44 changes: 0 additions & 44 deletions src/main/as3/flashx/funk/ioc/Injector.as

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/as3/flashx/funk/ioc/inject.as
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package flashx.funk.ioc {
throw new ArgumentError("Given type must not be null.")
}

const currentScope: IModule = Injector.module_internal::currentScope
const currentScope: IModule = AbstractModule.module_internal::currentScope

return currentScope.getInstance(klass)
}
Expand Down

0 comments on commit f299471

Please sign in to comment.