From 396c102c7c43f6ec345d3d633699cfb0929f83fb Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Thu, 6 Apr 2017 11:20:34 -0700 Subject: [PATCH] Fix _hasAccessor for readOnly. Collapse addBinding & addBindingEffects --- lib/mixins/element-mixin.html | 4 +++- lib/mixins/property-effects.html | 29 +++++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/mixins/element-mixin.html b/lib/mixins/element-mixin.html index 17e1287264..0e48f7897d 100644 --- a/lib/mixins/element-mixin.html +++ b/lib/mixins/element-mixin.html @@ -576,7 +576,9 @@ let value = typeof info.value == 'function' ? info.value.call(this) : info.value; - if (this._hasPropertyEffect(p)) { + // Set via `_setProperty` if there is an accessor, to enable + // initializing readOnly property defaults + if (this._hasAccessor(p)) { this._setProperty(p, value) } else { this[p] = value; diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 0d4e023b31..2e5f1d85c4 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -447,16 +447,6 @@ // -- bindings ---------------------------------------------- - function addBinding(nodeInfo, kind, target, parts, literal) { - nodeInfo.bindings = nodeInfo.bindings || []; - let binding = { - kind, target, parts, literal, - isCompound: (parts.length !== 1) - }; - nodeInfo.bindings.push(binding); - return binding; - } - /** * Adds "binding" property effects for the template annotation * ("note" for short) and node index specified. These may either be normal @@ -471,10 +461,17 @@ * be included as a dependency to the effect. * @private */ - function addBindingEffects(constructor, templateInfo, binding, index) { + function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) { + // Create binding metadata and add to nodeInfo + nodeInfo.bindings = nodeInfo.bindings || []; + let binding = { kind, target, parts, literal, isCompound: (parts.length !== 1) }; + let index = templateInfo.nodeInfoList.length; + nodeInfo.bindings.push(binding); + // Add 2-way binding listener metadata to templateInfo if (shouldAddListener(binding)) { addAnnotatedListener(templateInfo, index, binding); } + // Add "propagate" property effects to templateInfo for (let i=0; i