@@ -143,8 +143,8 @@ export class ProtoViewFactory {
143143 ListWrapper . map ( allDirectives , directiveBinding => directiveBinding . metadata ) ;
144144 var nestedPvsWithIndex = _collectNestedProtoViews ( rootRenderProtoView ) ;
145145 var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings ( nestedPvsWithIndex ) ;
146- var nestedPvVariableNames =
147- _collectNestedProtoViewsVariableNames ( nestedPvsWithIndex , nestedPvVariableBindings ) ;
146+ var nestedPvVariableNames = _collectNestedProtoViewsVariableNames ( nestedPvsWithIndex ) ;
147+
148148 var changeDetectorDefs =
149149 _getChangeDetectorDefinitions ( hostComponentBinding . metadata , nestedPvsWithIndex ,
150150 nestedPvVariableNames , allRenderDirectiveMetadata ) ;
@@ -174,10 +174,7 @@ export function getChangeDetectorDefinitions(
174174 hostComponentMetadata : renderApi . DirectiveMetadata , rootRenderProtoView : renderApi . ProtoViewDto ,
175175 allRenderDirectiveMetadata : List < renderApi . DirectiveMetadata > ) : List < ChangeDetectorDefinition > {
176176 var nestedPvsWithIndex = _collectNestedProtoViews ( rootRenderProtoView ) ;
177- var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings ( nestedPvsWithIndex ) ;
178- var nestedPvVariableNames =
179- _collectNestedProtoViewsVariableNames ( nestedPvsWithIndex , nestedPvVariableBindings ) ;
180-
177+ var nestedPvVariableNames = _collectNestedProtoViewsVariableNames ( nestedPvsWithIndex ) ;
181178 return _getChangeDetectorDefinitions ( hostComponentMetadata , nestedPvsWithIndex ,
182179 nestedPvVariableNames , allRenderDirectiveMetadata ) ;
183180}
@@ -235,8 +232,6 @@ function _createAppProtoView(
235232 variableBindings : Map < string , string > , allDirectives : List < DirectiveBinding > ) : AppProtoView {
236233 var elementBinders = renderProtoView . elementBinders ;
237234 var protoView = new AppProtoView ( renderProtoView . render , protoChangeDetector , variableBindings ) ;
238-
239- // TODO: vsavkin refactor to pass element binders into proto view
240235 _createElementBinders ( protoView , elementBinders , allDirectives ) ;
241236 _bindDirectiveEvents ( protoView , elementBinders ) ;
242237
@@ -255,31 +250,30 @@ function _createVariableBindings(renderProtoView): Map<string, string> {
255250 MapWrapper . forEach ( renderProtoView . variableBindings , ( mappedName , varName ) => {
256251 MapWrapper . set ( variableBindings , varName , mappedName ) ;
257252 } ) ;
258- ListWrapper . forEach ( renderProtoView . elementBinders , binder => {
259- MapWrapper . forEach ( binder . variableBindings , ( mappedName , varName ) => {
260- MapWrapper . set ( variableBindings , varName , mappedName ) ;
261- } ) ;
262- } ) ;
263253 return variableBindings ;
264254}
265255
266256function _collectNestedProtoViewsVariableNames (
267- nestedPvsWithIndex : List < RenderProtoViewWithIndex > ,
268- nestedPvVariableBindings : List < Map < string , string > > ) : List < List < string > > {
257+ nestedPvsWithIndex : List < RenderProtoViewWithIndex > ) : List < List < string > > {
269258 var nestedPvVariableNames = ListWrapper . createFixedSize ( nestedPvsWithIndex . length ) ;
270259 ListWrapper . forEach ( nestedPvsWithIndex , ( pvWithIndex ) => {
271260 var parentVariableNames =
272261 isPresent ( pvWithIndex . parentIndex ) ? nestedPvVariableNames [ pvWithIndex . parentIndex ] : null ;
273262 nestedPvVariableNames [ pvWithIndex . index ] =
274- _createVariableNames ( parentVariableNames , nestedPvVariableBindings [ pvWithIndex . index ] ) ;
263+ _createVariableNames ( parentVariableNames , pvWithIndex . renderProtoView ) ;
275264 } ) ;
276265 return nestedPvVariableNames ;
277266}
278267
279- function _createVariableNames ( parentVariableNames , variableBindings ) : List < string > {
280- var variableNames = isPresent ( parentVariableNames ) ? ListWrapper . clone ( parentVariableNames ) : [ ] ;
281- MapWrapper . forEach ( variableBindings , ( local , v ) => { ListWrapper . push ( variableNames , local ) ; } ) ;
282- return variableNames ;
268+
269+ function _createVariableNames ( parentVariableNames , renderProtoView ) : List < string > {
270+ var res = isBlank ( parentVariableNames ) ? [ ] : ListWrapper . clone ( parentVariableNames ) ;
271+ MapWrapper . forEach ( renderProtoView . variableBindings ,
272+ ( mappedName , varName ) => { res . push ( mappedName ) ; } ) ;
273+ ListWrapper . forEach ( renderProtoView . elementBinders , binder => {
274+ MapWrapper . forEach ( binder . variableBindings , ( mappedName , varName ) => { res . push ( mappedName ) ; } ) ;
275+ } ) ;
276+ return res ;
283277}
284278
285279function _createElementBinders ( protoView , elementBinders , allDirectiveBindings ) {
0 commit comments