From f15e4ee6882daedcf476236f33700459c94b5499 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Thu, 27 Apr 2017 12:06:36 -0700 Subject: [PATCH] initialize properties in `_initializeProperties` rather than `constructor` (allows work to be done before `_initializeProperties` and is needed for proto/instance property initialization . --- closure.log | 20 ++++++++++---------- externs/closure-types.js | 3 +++ lib/mixins/property-accessors.html | 14 +++++++------- lib/mixins/property-effects.html | 4 ++-- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/closure.log b/closure.log index aafe05f9ac..0d8578eca4 100644 --- a/closure.log +++ b/closure.log @@ -1262,7 +1262,7 @@ Found : Element let parts = this.split(path); ^^^^ -/polymer.html_script_8.js:117: WARNING - Function this._attributeToProperty: called with 2 argument(s). Function requires at least 3 argument(s) and at most 3. +/polymer.html_script_8.js:110: WARNING - Function this._attributeToProperty: called with 2 argument(s). Function requires at least 3 argument(s) and at most 3. this._attributeToProperty(name, value); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1342,39 +1342,39 @@ Found : Node{$:Object{}, __noInsertionPoint:boolean, nodeList:Array} return dom; ^^^^^^^^^^^ -externs/closure-types.js:375: WARNING - property connectedCallback not defined on any supertype of Polymer_ElementMixin +externs/closure-types.js:378: WARNING - property connectedCallback not defined on any supertype of Polymer_ElementMixin Polymer_ElementMixin.prototype.connectedCallback = function(){}; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:379: WARNING - property disconnectedCallback not defined on any supertype of Polymer_ElementMixin +externs/closure-types.js:382: WARNING - property disconnectedCallback not defined on any supertype of Polymer_ElementMixin Polymer_ElementMixin.prototype.disconnectedCallback = function(){}; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:399: WARNING - property attributeChangedCallback not defined on any supertype of Polymer_ElementMixin +externs/closure-types.js:402: WARNING - property attributeChangedCallback not defined on any supertype of Polymer_ElementMixin Polymer_ElementMixin.prototype.attributeChangedCallback = function(name, old, value){}; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:733: WARNING - property mutableData on interface Polymer_OptionalMutableData is not implemented by type OptionalMutableData +externs/closure-types.js:736: WARNING - property mutableData on interface Polymer_OptionalMutableData is not implemented by type OptionalMutableData Polymer_OptionalMutableData.prototype.mutableData; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:747: WARNING - property items on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin +externs/closure-types.js:750: WARNING - property items on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin Polymer_ArraySelectorMixin.prototype.items; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:750: WARNING - property multi on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin +externs/closure-types.js:753: WARNING - property multi on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin Polymer_ArraySelectorMixin.prototype.multi; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:753: WARNING - property selected on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin +externs/closure-types.js:756: WARNING - property selected on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin Polymer_ArraySelectorMixin.prototype.selected; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:756: WARNING - property selectedItem on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin +externs/closure-types.js:759: WARNING - property selectedItem on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin Polymer_ArraySelectorMixin.prototype.selectedItem; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:759: WARNING - property toggle on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin +externs/closure-types.js:762: WARNING - property toggle on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin Polymer_ArraySelectorMixin.prototype.toggle; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/externs/closure-types.js b/externs/closure-types.js index 0641bc943a..641c231c11 100644 --- a/externs/closure-types.js +++ b/externs/closure-types.js @@ -143,6 +143,9 @@ Polymer_TemplateStamp.prototype._removeEventListenerFromNode = function(node, ev */ function Polymer_PropertyEffects(){} /** +*/ +Polymer_PropertyEffects.prototype._initializeProperties = function(){}; +/** * @override * @param {*} props */ diff --git a/lib/mixins/property-accessors.html b/lib/mixins/property-accessors.html index 9da61d5922..5fba0e85ea 100644 --- a/lib/mixins/property-accessors.html +++ b/lib/mixins/property-accessors.html @@ -117,13 +117,6 @@ constructor() { super(); - this.__serializing = false; - this.__dataCounter = 0; - this.__dataInitialized = false; - this.__dataInvalid = false; - this.__data = {}; - this.__dataPending = null; - this.__dataOld = null; this._initializeProperties(); } @@ -142,6 +135,13 @@ * @protected */ _initializeProperties() { + this.__serializing = false; + this.__dataCounter = 0; + this.__dataInitialized = false; + this.__dataInvalid = false; + this.__data = {}; + this.__dataPending = null; + this.__dataOld = null; if (this.__dataProto) { this._initializeProtoProperties(this.__dataProto); this.__dataProto = null; diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 2d1e18536f..3174667eff 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -1073,8 +1073,8 @@ return TYPES; } - constructor() { - super(); + _initializeProperties() { + super._initializeProperties(); this.__dataPendingClients = null; this.__dataToNotify = null; this.__dataLinkedPaths = null;