From c0a99ee7b1e389a90e3804014ba552f7094c5b2b Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 8 Jan 2015 12:16:37 -0800 Subject: [PATCH] perf: remove field declarations from branches in constructors This should help with hidden class detection. --- modules/core/src/compiler/view.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/modules/core/src/compiler/view.js b/modules/core/src/compiler/view.js index 34d79091e0..564ae93526 100644 --- a/modules/core/src/compiler/view.js +++ b/modules/core/src/compiler/view.js @@ -53,13 +53,9 @@ export class View { this.viewPorts = null; this.preBuiltObjects = null; this.context = null; - - // contextWithLocals - if (MapWrapper.size(protoContextLocals) > 0) { - this.contextWithLocals = new ContextWithVariableBindings(null, MapWrapper.clone(protoContextLocals)); - } else { - this.contextWithLocals = null; - } + this.contextWithLocals = (MapWrapper.size(protoContextLocals) > 0) + ? new ContextWithVariableBindings(null, MapWrapper.clone(protoContextLocals)) + : null; } 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.elementsWithBindingCount = 0; this.instantiateInPlace = false; - if (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS)) { - this.rootBindingOffset = 1; - } else { - this.rootBindingOffset = 0; - } + this.rootBindingOffset = (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS)) + ? 1 : 0; this.isTemplateElement = this.element instanceof TemplateElement; }