From 0b22959ff9bd4d7338c05ab1c46128bea65e7317 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 26 Apr 2017 17:40:16 -0700 Subject: [PATCH] Fix more closure warnings. --- closure.log | 56 +++------------------------- lib/elements/dom-bind.html | 11 +++++- lib/legacy/templatizer-behavior.html | 5 ++- lib/mixins/mutable-data.html | 3 ++ 4 files changed, 22 insertions(+), 53 deletions(-) diff --git a/closure.log b/closure.log index bbd7cf4588..71b25cd701 100644 --- a/closure.log +++ b/closure.log @@ -797,7 +797,7 @@ Found : HTMLElement<|function(new:HTMLElement):?|> window.Polymer._polymerFn = function(info) { ^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_25.js:170: WARNING - Property mutableData never defined on this of type OptionalMutableData +/polymer.html_script_25.js:173: WARNING - Property mutableData never defined on this of type OptionalMutableData return mutablePropertyChange(this, property, value, old, this.mutableData); ^^^^^^^^^^^^^^^^ @@ -832,63 +832,19 @@ Found : $polymer_html_script_26$classdecl$var2<|function(new:$polymer_html_sc return klass; ^^^^^^^^^^^^^ -/polymer.html_script_27.js:117: WARNING - Property ctor never defined on this of type Polymer_LegacyElementMixin - return new this.ctor(model); - ^^^^^^^^^ - -/polymer.html_script_27.js:132: WARNING - Property _templatizerTemplate never defined on this of type Polymer_LegacyElementMixin - return Polymer.Templatize.modelForElement(this._templatizerTemplate, el); - ^^^^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_28.js:40: WARNING - Cannot add property mutableData to a struct instance after it is constructed. +/polymer.html_script_28.js:49: WARNING - Cannot add property mutableData to a struct instance after it is constructed. this.mutableData = true; ^^^^^^^^^^^^^^^^ -/polymer.html_script_28.js:52: WARNING - Property root never defined on this of type DomBind{parentNode:Node} - this.parentNode.insertBefore(this.root, this); - ^^^^^^^^^ - -/polymer.html_script_28.js:58: WARNING - Property root never defined on this of type DomBind{__children:{length:number} (loose)} - this.root.appendChild(this.__children[i]); - ^^^^^^^^^ - -/polymer.html_script_28.js:77: WARNING - Function $jscomp$this.render: called with 1 argument(s). Function requires at least 0 argument(s) and at most 0. +/polymer.html_script_28.js:86: WARNING - Function $jscomp$this.render: called with 1 argument(s). Function requires at least 0 argument(s) and at most 0. this.render(template); ^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_28.js:85: WARNING - Cannot add property root to a struct instance after it is constructed. - this.root = this._stampTemplate(template); - ^^^^^^^^^ - -/polymer.html_script_28.js:85: WARNING - Property _stampTemplate never defined on this of type DomBind +/polymer.html_script_28.js:94: WARNING - Property _stampTemplate never defined on this of type DomBind this.root = this._stampTemplate(template); ^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_28.js:86: WARNING - Cannot add property $ to a struct instance after it is constructed. - this.$ = this.root.$; - ^^^^^^ - -/polymer.html_script_28.js:86: WARNING - Property root never defined on this of type DomBind - this.$ = this.root.$; - ^^^^^^^^^ - -/polymer.html_script_28.js:87: WARNING - Cannot add property __children to a struct instance after it is constructed. - this.__children = []; - ^^^^^^^^^^^^^^^ - -/polymer.html_script_28.js:88: WARNING - Property root never defined on this of type DomBind - for (let n=this.root.firstChild; n; n=n.nextSibling) { - ^^^^^^^^^ - -/polymer.html_script_28.js:89: WARNING - Property __children never defined on this of type DomBind - this.__children[this.__children.length] = n; - ^^^^^^^^^^^^^^^ - -/polymer.html_script_28.js:89: WARNING - Property __children never defined on this of type DomBind - this.__children[this.__children.length] = n; - ^^^^^^^^^^^^^^^ - -/polymer.html_script_28.js:91: WARNING - Property _flushProperties never defined on this of type DomBind +/polymer.html_script_28.js:100: WARNING - Property _flushProperties never defined on this of type DomBind{__children:Array, root:{$:?, firstChild:?} (loose)} this._flushProperties(); ^^^^^^^^^^^^^^^^^^^^^ @@ -1483,4 +1439,4 @@ externs/closure-types.js:759: WARNING - property toggle on interface Polymer_Arr Polymer_ArraySelectorMixin.prototype.toggle; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -0 error(s), 326 warning(s), 72.6% typed +0 error(s), 315 warning(s), 72.6% typed diff --git a/lib/elements/dom-bind.html b/lib/elements/dom-bind.html index 874e374af9..b4f376770b 100644 --- a/lib/elements/dom-bind.html +++ b/lib/elements/dom-bind.html @@ -40,8 +40,10 @@ * document and bind elements to the `dom-bind` element itself as the * binding scope. * - * @extends HTMLElement * @mixes Polymer.PropertyEffects + * @mixes Polymer.OptionalMutableData + * @mixes Polymer.GestureEventListeners + * @extends HTMLElement * @memberof Polymer * @summary Custom element to allow using Polymer's template features (data * binding, declarative event listeners, etc.) in the main document. @@ -50,6 +52,13 @@ static get observedAttributes() { return ['mutable-data'] } + constructor() { + super(); + this.root = null; + this.$ = null; + this.__children = null; + } + // assumes only one observed attribute attributeChangedCallback() { this.mutableData = true; diff --git a/lib/legacy/templatizer-behavior.html b/lib/legacy/templatizer-behavior.html index 8d6018b64f..8ed2878a8d 100644 --- a/lib/legacy/templatizer-behavior.html +++ b/lib/legacy/templatizer-behavior.html @@ -17,6 +17,7 @@ let TemplateInstanceBase = Polymer.TemplateInstanceBase; // eslint-disable-line /** * @typedef {{ + * _templatizerTemplate: HTMLTemplateElement, * _parentModel: boolean, * _instanceProps: Object, * _forwardHostPropV2: Function, @@ -123,7 +124,7 @@ * populate into the template bindings. * @return {TemplateInstanceBase} Returns the created instance of * the template prepared by `templatize`. - * @this {Polymer_LegacyElementMixin} + * @this {TemplatizerUser} */ stamp(model) { return new this.ctor(model); @@ -138,7 +139,7 @@ * @param {HTMLElement} el Element for which to return a template model. * @return {TemplateInstanceBase} Model representing the binding scope for * the element. - * @this {Polymer_LegacyElementMixin} + * @this {TemplatizerUser} */ modelForElement(el) { return Polymer.Templatize.modelForElement(this._templatizerTemplate, el); diff --git a/lib/mixins/mutable-data.html b/lib/mixins/mutable-data.html index 9cb64930fe..30235c17a6 100644 --- a/lib/mixins/mutable-data.html +++ b/lib/mixins/mutable-data.html @@ -99,11 +99,14 @@ } } + /** @type boolean */ + MutableData.prototype.mutableData = false; return MutableData; }); + /** * Element class mixin to add the optional ability to skip strict * dirty-checking for objects and arrays (always consider them to be