From e3c6b254111920902fcc982ab3e4793ed6988333 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 5 Feb 2019 17:24:09 -0800 Subject: [PATCH 1/7] Backport closure compiler fixes from internal --- lib/legacy/class.js | 2 +- lib/legacy/legacy-data-mixin.js | 27 +++++++++++++++++++++++---- lib/legacy/legacy-element-mixin.js | 6 +++--- lib/legacy/polymer.dom.js | 15 +++++++++------ lib/mixins/dir-mixin.js | 16 ++++++++-------- lib/mixins/disable-upgrade-mixin.js | 16 ++++++++-------- lib/mixins/element-mixin.js | 19 ++++++++++--------- lib/mixins/properties-changed.js | 2 +- lib/mixins/property-effects.js | 18 +++++++++--------- lib/utils/gestures.js | 2 +- lib/utils/telemetry.js | 2 +- lib/utils/templatize.js | 2 +- 12 files changed, 75 insertions(+), 52 deletions(-) diff --git a/lib/legacy/class.js b/lib/legacy/class.js index 73f59dd1ac..6e249b2fa2 100644 --- a/lib/legacy/class.js +++ b/lib/legacy/class.js @@ -180,7 +180,7 @@ function flattenBehaviors(behaviors, list, exclude) { /** * @param {!PolymerInit} info Polymer info object * @param {function(new:HTMLElement)} Base base class to extend with info object - * @param {Object} behaviors behaviors to copy into the element + * @param {Object=} behaviors behaviors to copy into the element * @return {function(new:HTMLElement)} Generated class * @suppress {checkTypes} * @private diff --git a/lib/legacy/legacy-data-mixin.js b/lib/legacy/legacy-data-mixin.js index 0788e4a3c6..b2a255386d 100644 --- a/lib/legacy/legacy-data-mixin.js +++ b/lib/legacy/legacy-data-mixin.js @@ -151,12 +151,31 @@ Polymer.Class = (info, mixin) => Class(info, // Apply LegacyDataMixin to Templatizer instances as well, and defer // runtime switch to the root's host (_methodHost) -templatize.mixin = - dedupingMixin(superClass => class extends LegacyDataMixin(superClass) { - get _legacyUndefinedCheck() { - return this._methodHost && this._methodHost._legacyUndefinedCheck; +/** + * @mixinFunction + * @polymer + */ +const TemplatizeMixin = + dedupingMixin(superClass => { + /** + * @constructor + * @extends {HTMLElement} + */ + const legacyBase = LegacyDataMixin(superClass); + /** + * @private + */ + class TemplateLegacy extends legacyBase { + get _legacyUndefinedCheck() { + return this._methodHost && this._methodHost._legacyUndefinedCheck; + } } + /** @type {!Polymer_PropertyEffects} */ + TemplateLegacy.prototype._methodHost; + return TemplateLegacy; }); +templatize.mixin = TemplatizeMixin; + console.info('LegacyDataMixin will be applied to all legacy elements.\n' + 'Set `_legacyUndefinedCheck: true` on element class to enable.'); diff --git a/lib/legacy/legacy-element-mixin.js b/lib/legacy/legacy-element-mixin.js index a32ada9d21..2ea2866a2c 100644 --- a/lib/legacy/legacy-element-mixin.js +++ b/lib/legacy/legacy-element-mixin.js @@ -530,7 +530,7 @@ export const LegacyElementMixin = dedupingMixin((base) => { */ distributeContent() { const thisEl = /** @type {Element} */ (this); - const domApi = /** @type {DomApi} */(dom(thisEl)); + const domApi = /** @type {PolymerDomApi} */(dom(thisEl)); if (window.ShadyDOM && domApi.shadowRoot) { ShadyDOM.flush(); } @@ -879,9 +879,9 @@ export const LegacyElementMixin = dedupingMixin((base) => { * @override */ toggleAttribute(name, bool) { - let node = /** @type {Element} */ this; + let node = /** @type {Element} */(this); if (arguments.length === 3) { - node = /** @type {Element} */ arguments[2]; + node = /** @type {Element} */(arguments[2]); } if (arguments.length == 1) { bool = !node.hasAttribute(name); diff --git a/lib/legacy/polymer.dom.js b/lib/legacy/polymer.dom.js index c7f2b04693..09502a19ae 100644 --- a/lib/legacy/polymer.dom.js +++ b/lib/legacy/polymer.dom.js @@ -42,7 +42,7 @@ export const matchesSelector = function(node, selector) { * @implements {PolymerDomApi} * @unrestricted */ -let DomApi = class { +class DomApi { /** * @param {Node} node Node for which to create a Polymer.dom helper object. @@ -197,7 +197,7 @@ let DomApi = class { * For shadow roots, returns the currently focused element within this * shadow root. * - * @return {Node|undefined} Currently focused element + * return {Node|undefined} Currently focused element * @override */ get activeElement() { @@ -378,7 +378,7 @@ DomApi.prototype.textContent; /** @type {string} */ DomApi.prototype.innerHTML; -export {DomApi}; +let DomApiImpl = DomApi; if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noPatch'] && window['ShadyDOM']['Wrapper']) { @@ -395,7 +395,7 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP } }); - DomApi = Wrapper; + DomApiImpl = Wrapper; Object.defineProperties(EventApi.prototype, { @@ -450,7 +450,7 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP */ export const dom = function(obj) { obj = obj || document; - if (obj instanceof DomApi) { + if (obj instanceof DomApiImpl) { return /** @type {!DomApi} */(obj); } if (obj instanceof EventApi) { @@ -461,9 +461,12 @@ export const dom = function(obj) { if (obj instanceof Event) { helper = new EventApi(obj); } else { - helper = new DomApi(/** @type {Node} */(obj)); + helper = new DomApiImpl(/** @type {Node} */(obj)); } obj['__domApi'] = helper; } return helper; }; + +const ExportedDomApi = DomApiImpl; +export {ExportedDomApi as DomApi}; diff --git a/lib/mixins/dir-mixin.js b/lib/mixins/dir-mixin.js index ffab79705e..7208e2eb73 100644 --- a/lib/mixins/dir-mixin.js +++ b/lib/mixins/dir-mixin.js @@ -1,13 +1,13 @@ /** + * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt The complete set of authors may be found + * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may + * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by + * Google as part of the polymer project is also subject to an additional IP + * rights grant found at http://polymer.github.io/PATENTS.txt * @suppress {checkPrototypalTypes} -@license -Copyright (c) 2017 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ + */ import { PropertyAccessors } from './property-accessors.js'; import { dedupingMixin } from '../utils/mixin.js'; diff --git a/lib/mixins/disable-upgrade-mixin.js b/lib/mixins/disable-upgrade-mixin.js index 9830907a6e..d04ee27a4b 100644 --- a/lib/mixins/disable-upgrade-mixin.js +++ b/lib/mixins/disable-upgrade-mixin.js @@ -1,13 +1,13 @@ /** + * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt The complete set of authors may be found + * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may + * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by + * Google as part of the polymer project is also subject to an additional IP + * rights grant found at http://polymer.github.io/PATENTS.txt * @suppress {checkPrototypalTypes} -@license -Copyright (c) 2017 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ + */ import { ElementMixin } from './element-mixin.js'; import { dedupingMixin } from '../utils/mixin.js'; diff --git a/lib/mixins/element-mixin.js b/lib/mixins/element-mixin.js index e4756ecfd3..84399ba333 100644 --- a/lib/mixins/element-mixin.js +++ b/lib/mixins/element-mixin.js @@ -1,13 +1,13 @@ /** + * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt The complete set of authors may be found + * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may + * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by + * Google as part of the polymer project is also subject to an additional IP + * rights grant found at http://polymer.github.io/PATENTS.txt * @suppress {checkPrototypalTypes} -@license -Copyright (c) 2017 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ + */ import '../utils/boot.js'; import { rootPath, strictTemplatePolicy, allowTemplateFromDomModule, legacyOptimizations, syncInitialRender } from '../utils/settings.js'; @@ -325,7 +325,7 @@ export const ElementMixin = dedupingMixin(base => { */ class PolymerElement extends polymerElementBase { - /** + /** * Current Polymer version in Semver notation. * @type {string} Semver notation of the current version of Polymer. */ @@ -765,6 +765,7 @@ export const ElementMixin = dedupingMixin(base => { * @param {Object=} effect Effect metadata object * @return {void} * @protected + * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do */ static _addTemplatePropertyEffect(templateInfo, prop, effect) { // Warn if properties are used in template without being declared. diff --git a/lib/mixins/properties-changed.js b/lib/mixins/properties-changed.js index e70959d251..78ec739ae2 100644 --- a/lib/mixins/properties-changed.js +++ b/lib/mixins/properties-changed.js @@ -498,7 +498,7 @@ export const PropertiesChanged = dedupingMixin( node.removeAttribute(attribute); } else { if (attribute === 'class' || attribute === 'name' || attribute === 'slot') { - node = wrap(node); + node = /** @type {?Element} */(wrap(node)); } node.setAttribute(attribute, str); } diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index a58111b8e9..ec0c174316 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -1,13 +1,13 @@ /** + * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt The complete set of authors may be found + * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may + * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by + * Google as part of the polymer project is also subject to an additional IP + * rights grant found at http://polymer.github.io/PATENTS.txt * @suppress {checkPrototypalTypes} -@license -Copyright (c) 2017 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ + */ import '../utils/boot.js'; import { wrap } from '../utils/wrap.js'; @@ -1172,7 +1172,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * the prototype on the instance. * * @override - * @param {!Object} props Properties to initialize on the prototype + * @param {Object} props Properties to initialize on the prototype * @return {void} */ _initializeProtoProperties(props) { diff --git a/lib/utils/gestures.js b/lib/utils/gestures.js index ac529bd2c5..54b2173717 100644 --- a/lib/utils/gestures.js +++ b/lib/utils/gestures.js @@ -660,7 +660,7 @@ export function setTouchAction(node, value) { function _fire(target, type, detail) { let ev = new Event(type, { bubbles: true, cancelable: true, composed: true }); ev.detail = detail; - wrap(target).dispatchEvent(ev); + wrap(/** @type {!Node} */(target)).dispatchEvent(ev); // forward `preventDefault` in a clean way if (ev.defaultPrevented) { let preventer = detail.preventer || detail.sourceEvent; diff --git a/lib/utils/telemetry.js b/lib/utils/telemetry.js index e28ff54808..5e12c3e5fb 100644 --- a/lib/utils/telemetry.js +++ b/lib/utils/telemetry.js @@ -29,7 +29,7 @@ export const registrations = []; * @private */ function _regLog(prototype) { - console.log('[' + prototype.is + ']: registered'); + console.log('[' + /** @type {?} */(prototype).is + ']: registered'); } /** diff --git a/lib/utils/templatize.js b/lib/utils/templatize.js index 4d32535e34..9f05135470 100644 --- a/lib/utils/templatize.js +++ b/lib/utils/templatize.js @@ -340,7 +340,7 @@ function createTemplatizerClass(template, templateInfo, options) { */ let templatizerBase = options.mutableData ? MutableTemplateInstanceBase : TemplateInstanceBase; - + // Affordance for global mixins onto TemplatizeInstance if (templatize.mixin) { templatizerBase = templatize.mixin(templatizerBase); From 42735d110cd27b5353a921d465c333ffc83282d7 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 6 Feb 2019 09:39:10 -0800 Subject: [PATCH 2/7] Ensure argument types match. --- lib/mixins/property-accessors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mixins/property-accessors.js b/lib/mixins/property-accessors.js index 074abdea74..bfa7f33a7e 100644 --- a/lib/mixins/property-accessors.js +++ b/lib/mixins/property-accessors.js @@ -164,7 +164,7 @@ export const PropertyAccessors = dedupingMixin(superClass => { * setter at instance time. This method is provided as an override * point for customizing or providing more efficient initialization. * - * @param {!Object} props Bag of property values that were overwritten + * @param {Object} props Bag of property values that were overwritten * when creating property accessors. * @return {void} * @protected From 4a24ba3c0fd227d6c36abe7575f2b193f26e747a Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 6 Feb 2019 09:39:58 -0800 Subject: [PATCH 3/7] Refactor symbols to make gen-typescript-declarations happy --- lib/legacy/polymer.dom.js | 77 +++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/lib/legacy/polymer.dom.js b/lib/legacy/polymer.dom.js index 09502a19ae..360221c691 100644 --- a/lib/legacy/polymer.dom.js +++ b/lib/legacy/polymer.dom.js @@ -42,7 +42,7 @@ export const matchesSelector = function(node, selector) { * @implements {PolymerDomApi} * @unrestricted */ -class DomApi { +class DomApiNative { /** * @param {Node} node Node for which to create a Polymer.dom helper object. @@ -210,7 +210,7 @@ function forwardMethods(proto, methods) { for (let i=0; i < methods.length; i++) { let method = methods[i]; /* eslint-disable valid-jsdoc */ - proto[method] = /** @this {DomApi} */ function() { + proto[method] = /** @this {DomApiNative} */ function() { return this.node[method].apply(this.node, arguments); }; /* eslint-enable */ @@ -222,7 +222,7 @@ function forwardReadOnlyProperties(proto, properties) { let name = properties[i]; Object.defineProperty(proto, name, { get: function() { - const domApi = /** @type {DomApi} */(this); + const domApi = /** @type {DomApiNative} */(this); return domApi.node[name]; }, configurable: true @@ -235,14 +235,14 @@ function forwardProperties(proto, properties) { let name = properties[i]; Object.defineProperty(proto, name, { /** - * @this {DomApi} + * @this {DomApiNative} * @return {*} . */ get: function() { return this.node[name]; }, /** - * @this {DomApi} + * @this {DomApiNative} * @param {*} value . */ set: function(value) { @@ -295,90 +295,90 @@ export class EventApi { * @param {boolean=} deep * @return {!Node} */ -DomApi.prototype.cloneNode; +DomApiNative.prototype.cloneNode; /** * @function * @param {!Node} node * @return {!Node} */ -DomApi.prototype.appendChild; +DomApiNative.prototype.appendChild; /** * @function * @param {!Node} newChild * @param {Node} refChild * @return {!Node} */ -DomApi.prototype.insertBefore; +DomApiNative.prototype.insertBefore; /** * @function * @param {!Node} node * @return {!Node} */ -DomApi.prototype.removeChild; +DomApiNative.prototype.removeChild; /** * @function * @param {!Node} oldChild * @param {!Node} newChild * @return {!Node} */ -DomApi.prototype.replaceChild; +DomApiNative.prototype.replaceChild; /** * @function * @param {string} name * @param {string} value * @return {void} */ -DomApi.prototype.setAttribute; +DomApiNative.prototype.setAttribute; /** * @function * @param {string} name * @return {void} */ -DomApi.prototype.removeAttribute; +DomApiNative.prototype.removeAttribute; /** * @function * @param {string} selector * @return {?Element} */ -DomApi.prototype.querySelector; +DomApiNative.prototype.querySelector; /** * @function * @param {string} selector * @return {!NodeList} */ -DomApi.prototype.querySelectorAll; +DomApiNative.prototype.querySelectorAll; /** @type {?Node} */ -DomApi.prototype.parentNode; +DomApiNative.prototype.parentNode; /** @type {?Node} */ -DomApi.prototype.firstChild; +DomApiNative.prototype.firstChild; /** @type {?Node} */ -DomApi.prototype.lastChild; +DomApiNative.prototype.lastChild; /** @type {?Node} */ -DomApi.prototype.nextSibling; +DomApiNative.prototype.nextSibling; /** @type {?Node} */ -DomApi.prototype.previousSibling; +DomApiNative.prototype.previousSibling; /** @type {?HTMLElement} */ -DomApi.prototype.firstElementChild; +DomApiNative.prototype.firstElementChild; /** @type {?HTMLElement} */ -DomApi.prototype.lastElementChild; +DomApiNative.prototype.lastElementChild; /** @type {?HTMLElement} */ -DomApi.prototype.nextElementSibling; +DomApiNative.prototype.nextElementSibling; /** @type {?HTMLElement} */ -DomApi.prototype.previousElementSibling; +DomApiNative.prototype.previousElementSibling; /** @type {!Array} */ -DomApi.prototype.childNodes; +DomApiNative.prototype.childNodes; /** @type {!Array} */ -DomApi.prototype.children; +DomApiNative.prototype.children; /** @type {?DOMTokenList} */ -DomApi.prototype.classList; +DomApiNative.prototype.classList; /** @type {string} */ -DomApi.prototype.textContent; +DomApiNative.prototype.textContent; /** @type {string} */ -DomApi.prototype.innerHTML; +DomApiNative.prototype.innerHTML; -let DomApiImpl = DomApi; +let DomApiImpl = DomApiNative; if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noPatch'] && window['ShadyDOM']['Wrapper']) { @@ -389,9 +389,9 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP class Wrapper extends window['ShadyDOM']['Wrapper'] {} // copy bespoke API onto wrapper - Object.getOwnPropertyNames(DomApi.prototype).forEach((prop) => { + Object.getOwnPropertyNames(DomApiNative.prototype).forEach((prop) => { if (prop != 'activeElement') { - Wrapper.prototype[prop] = DomApi.prototype[prop]; + Wrapper.prototype[prop] = DomApiNative.prototype[prop]; } }); @@ -416,24 +416,26 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP } else { - forwardMethods(DomApi.prototype, [ + forwardMethods(DomApiNative.prototype, [ 'cloneNode', 'appendChild', 'insertBefore', 'removeChild', 'replaceChild', 'setAttribute', 'removeAttribute', 'querySelector', 'querySelectorAll' ]); - forwardReadOnlyProperties(DomApi.prototype, [ + forwardReadOnlyProperties(DomApiNative.prototype, [ 'parentNode', 'firstChild', 'lastChild', 'nextSibling', 'previousSibling', 'firstElementChild', 'lastElementChild', 'nextElementSibling', 'previousElementSibling', 'childNodes', 'children', 'classList' ]); - forwardProperties(DomApi.prototype, [ + forwardProperties(DomApiNative.prototype, [ 'textContent', 'innerHTML' ]); } +export const DomApi = DomApiImpl; + /** * Legacy DOM and Event manipulation API wrapper factory used to abstract * differences between native Shadow DOM and "Shady DOM" when polyfilling on @@ -445,8 +447,8 @@ if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noP * * @summary Legacy DOM and Event manipulation API wrapper factory used to * abstract differences between native Shadow DOM and "Shady DOM." - * @param {(Node|Event|DomApi|EventApi)=} obj Node or event to operate on - * @return {!DomApi|!EventApi} Wrapper providing either node API or event API + * @param {(Node|Event|DomApiNative|EventApi)=} obj Node or event to operate on + * @return {!DomApiNative|!EventApi} Wrapper providing either node API or event API */ export const dom = function(obj) { obj = obj || document; @@ -467,6 +469,3 @@ export const dom = function(obj) { } return helper; }; - -const ExportedDomApi = DomApiImpl; -export {ExportedDomApi as DomApi}; From ae899c54202e53bf6bdf681819c46491481ed475 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 6 Feb 2019 11:00:59 -0800 Subject: [PATCH 4/7] Remove semicolon after class definition (lint). --- lib/legacy/polymer.dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/legacy/polymer.dom.js b/lib/legacy/polymer.dom.js index 360221c691..442d428147 100644 --- a/lib/legacy/polymer.dom.js +++ b/lib/legacy/polymer.dom.js @@ -204,7 +204,7 @@ class DomApiNative { let node = this.node; return node._activeElement !== undefined ? node._activeElement : node.activeElement; } -}; +} function forwardMethods(proto, methods) { for (let i=0; i < methods.length; i++) { From fb2465620d179c7a10e5c96b66e06f6789cf848d Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Wed, 6 Feb 2019 11:00:30 -0800 Subject: [PATCH 5/7] use JSCompiler_renameProperty bare --- lib/legacy/class.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/legacy/class.js b/lib/legacy/class.js index 6e249b2fa2..bb4326e370 100644 --- a/lib/legacy/class.js +++ b/lib/legacy/class.js @@ -197,7 +197,7 @@ function GenerateClassFromInfo(info, Base, behaviors) { // explicitly not calling super._finalizeClass static _finalizeClass() { // if calling via a subclass that hasn't been generated, pass through to super - if (!this.hasOwnProperty(window.JSCompiler_renameProperty('generatedFrom', this))) { + if (!this.hasOwnProperty(JSCompiler_renameProperty('generatedFrom', this))) { super._finalizeClass(); } else { // interleave properties and observers per behavior and `info` From 4321da01f48ad9c800ac96a61b204cabc25bc74a Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Wed, 6 Feb 2019 11:05:16 -0800 Subject: [PATCH 6/7] address feedback --- lib/mixins/dir-mixin.js | 2 +- lib/mixins/disable-upgrade-mixin.js | 2 +- lib/mixins/element-mixin.js | 2 +- lib/mixins/property-effects.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mixins/dir-mixin.js b/lib/mixins/dir-mixin.js index 7208e2eb73..7d48fc4ff9 100644 --- a/lib/mixins/dir-mixin.js +++ b/lib/mixins/dir-mixin.js @@ -1,4 +1,5 @@ /** + * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt The complete set of authors may be found @@ -6,7 +7,6 @@ * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by * Google as part of the polymer project is also subject to an additional IP * rights grant found at http://polymer.github.io/PATENTS.txt - * @suppress {checkPrototypalTypes} */ import { PropertyAccessors } from './property-accessors.js'; diff --git a/lib/mixins/disable-upgrade-mixin.js b/lib/mixins/disable-upgrade-mixin.js index d04ee27a4b..c363259ab5 100644 --- a/lib/mixins/disable-upgrade-mixin.js +++ b/lib/mixins/disable-upgrade-mixin.js @@ -1,4 +1,5 @@ /** + * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt The complete set of authors may be found @@ -6,7 +7,6 @@ * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by * Google as part of the polymer project is also subject to an additional IP * rights grant found at http://polymer.github.io/PATENTS.txt - * @suppress {checkPrototypalTypes} */ import { ElementMixin } from './element-mixin.js'; diff --git a/lib/mixins/element-mixin.js b/lib/mixins/element-mixin.js index 84399ba333..06fea1a65e 100644 --- a/lib/mixins/element-mixin.js +++ b/lib/mixins/element-mixin.js @@ -1,4 +1,5 @@ /** + * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt The complete set of authors may be found @@ -6,7 +7,6 @@ * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by * Google as part of the polymer project is also subject to an additional IP * rights grant found at http://polymer.github.io/PATENTS.txt - * @suppress {checkPrototypalTypes} */ import '../utils/boot.js'; diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index ec0c174316..daa371f496 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -1,4 +1,5 @@ /** + * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt The complete set of authors may be found @@ -6,7 +7,6 @@ * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by * Google as part of the polymer project is also subject to an additional IP * rights grant found at http://polymer.github.io/PATENTS.txt - * @suppress {checkPrototypalTypes} */ import '../utils/boot.js'; From aba0f9049fb43d50b068e01e2751ef274cab1dd1 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Wed, 6 Feb 2019 12:34:24 -0800 Subject: [PATCH 7/7] Add `@fileoverview`, put `@suppress` after it --- lib/mixins/dir-mixin.js | 1 + lib/mixins/disable-upgrade-mixin.js | 1 + lib/mixins/element-mixin.js | 1 + lib/mixins/property-effects.js | 1 + 4 files changed, 4 insertions(+) diff --git a/lib/mixins/dir-mixin.js b/lib/mixins/dir-mixin.js index 7d48fc4ff9..3237511791 100644 --- a/lib/mixins/dir-mixin.js +++ b/lib/mixins/dir-mixin.js @@ -1,4 +1,5 @@ /** + * @fileoverview * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at diff --git a/lib/mixins/disable-upgrade-mixin.js b/lib/mixins/disable-upgrade-mixin.js index c363259ab5..a97aa9e9ba 100644 --- a/lib/mixins/disable-upgrade-mixin.js +++ b/lib/mixins/disable-upgrade-mixin.js @@ -1,4 +1,5 @@ /** + * @fileoverview * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at diff --git a/lib/mixins/element-mixin.js b/lib/mixins/element-mixin.js index 06fea1a65e..c931fb7fc0 100644 --- a/lib/mixins/element-mixin.js +++ b/lib/mixins/element-mixin.js @@ -1,4 +1,5 @@ /** + * @fileoverview * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index daa371f496..c92bea3fa6 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -1,4 +1,5 @@ /** + * @fileoverview * @suppress {checkPrototypalTypes} * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at