perf: remove field declarations from branches in constructors

This should help with hidden class detection.
This commit is contained in:
Misko Hevery 2015-01-08 12:16:37 -08:00
parent 6e9f48564f
commit c0a99ee7b1
1 changed files with 5 additions and 12 deletions

View File

@ -53,13 +53,9 @@ export class View {
this.viewPorts = null; this.viewPorts = null;
this.preBuiltObjects = null; this.preBuiltObjects = null;
this.context = null; this.context = null;
this.contextWithLocals = (MapWrapper.size(protoContextLocals) > 0)
// contextWithLocals ? new ContextWithVariableBindings(null, MapWrapper.clone(protoContextLocals))
if (MapWrapper.size(protoContextLocals) > 0) { : null;
this.contextWithLocals = new ContextWithVariableBindings(null, MapWrapper.clone(protoContextLocals));
} else {
this.contextWithLocals = null;
}
} }
init(elementInjectors:List, rootElementInjectors:List, textNodes: List, bindElements:List, viewPorts:List, preBuiltObjects:List, componentChildViews:List) { init(elementInjectors:List, rootElementInjectors:List, textNodes: List, bindElements:List, viewPorts:List, preBuiltObjects:List, componentChildViews:List) {
@ -271,11 +267,8 @@ export class ProtoView {
this.textNodesWithBindingCount = 0; this.textNodesWithBindingCount = 0;
this.elementsWithBindingCount = 0; this.elementsWithBindingCount = 0;
this.instantiateInPlace = false; this.instantiateInPlace = false;
if (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS)) { this.rootBindingOffset = (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS))
this.rootBindingOffset = 1; ? 1 : 0;
} else {
this.rootBindingOffset = 0;
}
this.isTemplateElement = this.element instanceof TemplateElement; this.isTemplateElement = this.element instanceof TemplateElement;
} }