refactor(ElementBinder): Store componentDirective and templateDirective as well.
This commit is contained in:
@ -17,7 +17,7 @@ export class Component extends Directive {
|
||||
template:TemplateConfig,
|
||||
lightDomServices:DomServicesFunction,
|
||||
shadowDomServices:DomServicesFunction,
|
||||
componentServices:ComponentServicesFunction,
|
||||
componentServices:Array,
|
||||
implementsTypes:Array<Type>
|
||||
}={})
|
||||
{
|
||||
|
@ -1,16 +1,20 @@
|
||||
import {ProtoElementInjector} from './element_injector';
|
||||
import {FIELD} from 'facade/lang';
|
||||
import {AnnotatedType} from './annotated_type';
|
||||
// Comment out as dartanalyzer does not look into @FIELD
|
||||
// import {List} from 'facade/collection';
|
||||
// import {ProtoView} from './view';
|
||||
|
||||
export class ElementBinder {
|
||||
@FIELD('final protoElementInjector:ProtoElementInjector')
|
||||
@FIELD('final componentDirective:AnnotatedType')
|
||||
@FIELD('final templateDirective:AnnotatedType')
|
||||
@FIELD('final textNodeIndices:List<int>')
|
||||
@FIELD('hasElementPropertyBindings:bool')
|
||||
@FIELD('nestedProtoView:ProtoView')
|
||||
constructor(protoElementInjector: ProtoElementInjector) {
|
||||
constructor(protoElementInjector: ProtoElementInjector, componentDirective:AnnotatedType, templateDirective:AnnotatedType) {
|
||||
this.protoElementInjector = protoElementInjector;
|
||||
this.componentDirective = componentDirective;
|
||||
this.templateDirective = templateDirective;
|
||||
// updated later when text nodes are bound
|
||||
this.textNodeIndices = [];
|
||||
// updated later when element properties are bound
|
||||
|
@ -52,7 +52,8 @@ export class ElementBinderBuilder extends CompileStep {
|
||||
var elementBinder;
|
||||
if (current.hasBindings) {
|
||||
var protoView = current.inheritedProtoView;
|
||||
elementBinder = protoView.bindElement(current.inheritedProtoElementInjector);
|
||||
elementBinder = protoView.bindElement(current.inheritedProtoElementInjector,
|
||||
current.componentDirective, current.templateDirective);
|
||||
|
||||
if (isPresent(current.textNodeBindings)) {
|
||||
this._bindTextNodes(protoView, current.textNodeBindings);
|
||||
|
@ -3,8 +3,10 @@ import {ListWrapper} from 'facade/collection';
|
||||
import {ProtoWatchGroup, WatchGroup, WatchGroupDispatcher} from 'change_detection/watch_group';
|
||||
import {Record} from 'change_detection/record';
|
||||
import {AST} from 'change_detection/parser/ast';
|
||||
|
||||
import {ProtoElementInjector, ElementInjector} from './element_injector';
|
||||
import {ElementBinder} from './element_binder';
|
||||
import {AnnotatedType} from './annotated_type';
|
||||
import {SetterFn} from 'change_detection/parser/closure_map';
|
||||
import {FIELD, IMPLEMENTS, int, isPresent, isBlank} from 'facade/lang';
|
||||
import {List} from 'facade/collection';
|
||||
@ -99,8 +101,9 @@ export class ProtoView {
|
||||
bindElements, this.protoWatchGroup, context);
|
||||
}
|
||||
|
||||
bindElement(protoElementInjector:ProtoElementInjector):ElementBinder {
|
||||
var elBinder = new ElementBinder(protoElementInjector);
|
||||
bindElement(protoElementInjector:ProtoElementInjector,
|
||||
componentDirective:AnnotatedType = null, templateDirective:AnnotatedType = null):ElementBinder {
|
||||
var elBinder = new ElementBinder(protoElementInjector, componentDirective, templateDirective);
|
||||
ListWrapper.push(this.elementBinders, elBinder);
|
||||
return elBinder;
|
||||
}
|
||||
|
Reference in New Issue
Block a user