refactor(ProtoElementInjector): change instantiate to take positional args

This commit is contained in:
vsavkin
2014-11-06 10:13:07 -08:00
parent b5f6417635
commit 9448d78aa8
6 changed files with 15 additions and 18 deletions

View File

@ -3,6 +3,7 @@ import {Math} from 'facade/math';
import {List, ListWrapper} from 'facade/collection';
import {Injector, Key, Dependency, bind, Binding, NoProviderError, ProviderError, CyclicDependencyError} from 'di/di';
import {Parent, Ancestor} from 'core/annotations/visibility';
import {View} from './view';
import {StaticKeys} from './static_keys';
var _MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10;
@ -148,12 +149,8 @@ export class ProtoElementInjector {
}
}
instantiate({view, parentElementInjector}):ElementInjector {
return new ElementInjector({
proto: this,
parent: parentElementInjector,
view: view
});
instantiate(parent:ElementInjector, view):ElementInjector {
return new ElementInjector(this, parent, view);
}
_createBinding(bindingOrType) {
@ -226,7 +223,7 @@ export class ElementInjector extends TreeNode {
@FIELD('_obj8:Object')
@FIELD('_obj9:Object')
@FIELD('_view:View')
constructor({proto, parent, view}) {
constructor(proto:ProtoElementInjector, parent:ElementInjector, view) {
super(parent);
this._proto = proto;
this._view = view;

View File

@ -115,7 +115,7 @@ export class ProtoView {
static _createElementInjector(element, parent:ElementInjector, proto:ProtoElementInjector) {
//TODO: vsavkin: pass element to `proto.instantiate()` once https://github.com/angular/angular/pull/98 is merged
return proto.hasBindings ? proto.instantiate({view:null, parentElementInjector:parent}) : null;
return proto.hasBindings ? proto.instantiate(parent, null) : null;
}
static _rootElementInjectors(injectors) {