refactor(change_detection): renamed BindingPropagationConfig to ChangeDetectorRef

This commit is contained in:
vsavkin
2015-04-14 07:47:12 -07:00
parent 213dabdceb
commit 8c1adabe1c
17 changed files with 89 additions and 73 deletions

View File

@ -8,7 +8,7 @@ import * as viewModule from 'angular2/src/core/compiler/view';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {NgElement} from 'angular2/src/core/compiler/ng_element';
import {Directive, Component, onChange, onDestroy, onAllChangesDone} from 'angular2/src/core/annotations/annotations';
import {BindingPropagationConfig} from 'angular2/change_detection';
import {ChangeDetectorRef} from 'angular2/change_detection';
import {QueryList} from './query_list';
var _MAX_DIRECTIVE_CONSTRUCTION_COUNTER = 10;
@ -46,7 +46,7 @@ class StaticKeys {
viewId:number;
ngElementId:number;
viewContainerId:number;
bindingPropagationConfigId:number;
changeDetectorRefId:number;
elementRefId:number;
constructor() {
@ -54,7 +54,7 @@ class StaticKeys {
this.viewId = Key.get(viewModule.AppView).id;
this.ngElementId = Key.get(NgElement).id;
this.viewContainerId = Key.get(ViewContainer).id;
this.bindingPropagationConfigId = Key.get(BindingPropagationConfig).id;
this.changeDetectorRefId = Key.get(ChangeDetectorRef).id;
this.elementRefId = Key.get(ElementRef).id;
}
@ -298,13 +298,13 @@ export class PreBuiltObjects {
view:viewModule.AppView;
element:NgElement;
viewContainer:ViewContainer;
bindingPropagationConfig:BindingPropagationConfig;
changeDetectorRef:ChangeDetectorRef;
constructor(view, element:NgElement, viewContainer:ViewContainer,
bindingPropagationConfig:BindingPropagationConfig) {
changeDetectorRef:ChangeDetectorRef) {
this.view = view;
this.element = element;
this.viewContainer = viewContainer;
this.bindingPropagationConfig = bindingPropagationConfig;
this.changeDetectorRef = changeDetectorRef;
}
}
@ -885,7 +885,7 @@ export class ElementInjector extends TreeNode {
if (keyId === staticKeys.viewId) return this._preBuiltObjects.view;
if (keyId === staticKeys.ngElementId) return this._preBuiltObjects.element;
if (keyId === staticKeys.viewContainerId) return this._preBuiltObjects.viewContainer;
if (keyId === staticKeys.bindingPropagationConfigId) return this._preBuiltObjects.bindingPropagationConfig;
if (keyId === staticKeys.changeDetectorRefId) return this._preBuiltObjects.changeDetectorRef;
//TODO add other objects as needed
return _undefined;

View File

@ -1,6 +1,6 @@
import {ListWrapper, MapWrapper, Map, StringMapWrapper, List} from 'angular2/src/facade/collection';
import {AST, Locals, ChangeDispatcher, ProtoChangeDetector, ChangeDetector,
ChangeRecord, BindingRecord, DirectiveRecord, BindingPropagationConfig} from 'angular2/change_detection';
ChangeRecord, BindingRecord, DirectiveRecord, ChangeDetectorRef} from 'angular2/change_detection';
import {ProtoElementInjector, ElementInjector, PreBuiltObjects, DirectiveBinding} from './element_injector';
import {ElementBinder} from './element_binder';

View File

@ -5,7 +5,7 @@ import {isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
import {NgElement} from 'angular2/src/core/compiler/ng_element';
import * as vcModule from './view_container';
import * as viewModule from './view';
import {BindingPropagationConfig} from 'angular2/change_detection';
import {ChangeDetectorRef} from 'angular2/change_detection';
// TODO(tbosch): Make this an OpaqueToken as soon as our transpiler supports this!
export const VIEW_POOL_CAPACITY = 'ViewFactory.viewPoolCapacity';
@ -77,12 +77,12 @@ export class ViewFactory {
elementInjectors[binderIdx] = elementInjector;
// componentChildViews
var bindingPropagationConfig = null;
var changeDetectorRef = null;
if (binder.hasStaticComponent()) {
var childView = this._createView(binder.nestedProtoView);
changeDetector.addShadowDomChild(childView.changeDetector);
bindingPropagationConfig = new BindingPropagationConfig(childView.changeDetector);
changeDetectorRef = new ChangeDetectorRef(childView.changeDetector);
componentChildViews[binderIdx] = childView;
}
@ -97,7 +97,7 @@ export class ViewFactory {
// preBuiltObjects
if (isPresent(elementInjector)) {
preBuiltObjects[binderIdx] = new eli.PreBuiltObjects(view, new NgElement(view, binderIdx), viewContainer,
bindingPropagationConfig);
changeDetectorRef);
}
}