diff --git a/lib/legacy/class.js b/lib/legacy/class.js index a35c0c5c84..f28f15d93f 100644 --- a/lib/legacy/class.js +++ b/lib/legacy/class.js @@ -159,7 +159,7 @@ function flattenBehaviors(behaviors, list, exclude) { * Copies property descriptors from source to target, overwriting all fields * of any previous descriptor for a property *except* for `value`, which is * merged in from the target if it does not exist on the source. - * + * * @param {*} target Target properties object * @param {*} source Source properties object */ @@ -215,10 +215,13 @@ function GenerateClassFromInfo(info, Base, behaviors) { class PolymerGenerated extends Base { // explicitly not calling super._finalizeClass + /** @nocollapse */ static _finalizeClass() { // if calling via a subclass that hasn't been generated, pass through to super if (!this.hasOwnProperty(JSCompiler_renameProperty('generatedFrom', this))) { - super._finalizeClass(); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + Base._finalizeClass.call(this); } else { // interleave properties and observers per behavior and `info` if (behaviorList) { @@ -243,6 +246,7 @@ function GenerateClassFromInfo(info, Base, behaviors) { } } + /** @nocollapse */ static get properties() { const properties = {}; if (behaviorList) { @@ -254,6 +258,7 @@ function GenerateClassFromInfo(info, Base, behaviors) { return properties; } + /** @nocollapse */ static get observers() { let observers = []; if (behaviorList) { diff --git a/lib/legacy/legacy-data-mixin.js b/lib/legacy/legacy-data-mixin.js index d3d84088e2..9f0556f142 100644 --- a/lib/legacy/legacy-data-mixin.js +++ b/lib/legacy/legacy-data-mixin.js @@ -94,7 +94,7 @@ export const LegacyDataMixin = dedupingMixin(superClass => { // undefined or not. Multi-property observers must have all arguments defined if (this._legacyUndefinedCheck && vals.length > 1) { for (let i=0; i { * @param {Object=} effect Effect metadata object * @return {void} * @protected + * @nocollapse */ static _addTemplatePropertyEffect(templateInfo, prop, effect) { - return super._addTemplatePropertyEffect(templateInfo, prop, wrapEffect(effect)); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + return superClass._addTemplatePropertyEffect.call( + this, templateInfo, prop, wrapEffect(effect)); } } diff --git a/lib/legacy/legacy-element-mixin.js b/lib/legacy/legacy-element-mixin.js index 2ea2866a2c..861fefb4c0 100644 --- a/lib/legacy/legacy-element-mixin.js +++ b/lib/legacy/legacy-element-mixin.js @@ -85,6 +85,7 @@ export const LegacyElementMixin = dedupingMixin((base) => { * @return {!Object} The `import.meta` object set on the prototype * @suppress {missingProperties} `this` is always in the instance in * closure for some reason even in a static method, rather than the class + * @nocollapse */ static get importMeta() { return this.prototype.importMeta; diff --git a/lib/mixins/dir-mixin.js b/lib/mixins/dir-mixin.js index 3237511791..0b2326fdc4 100644 --- a/lib/mixins/dir-mixin.js +++ b/lib/mixins/dir-mixin.js @@ -113,9 +113,12 @@ export const DirMixin = dedupingMixin((base) => { * @param {string} baseURI . * @return {string} . * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static _processStyleText(cssText, baseURI) { - cssText = super._processStyleText(cssText, baseURI); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + cssText = elementBase._processStyleText.call(this, cssText, baseURI); if (!SHIM_SHADOW && DIR_CHECK.test(cssText)) { cssText = this._replaceDirInCssText(cssText); this.__activateDir = true; @@ -128,6 +131,7 @@ export const DirMixin = dedupingMixin((base) => { * * @param {string} text CSS text to replace DIR * @return {string} Modified CSS + * @nocollapse */ static _replaceDirInCssText(text) { let replacedText = text; diff --git a/lib/mixins/element-mixin.js b/lib/mixins/element-mixin.js index 7c28589f9a..7e40fc0039 100644 --- a/lib/mixins/element-mixin.js +++ b/lib/mixins/element-mixin.js @@ -329,6 +329,7 @@ export const ElementMixin = dedupingMixin(base => { /** * Current Polymer version in Semver notation. * @type {string} Semver notation of the current version of Polymer. + * @nocollapse */ static get polymerElementVersion() { return version; @@ -340,9 +341,12 @@ export const ElementMixin = dedupingMixin(base => { * @return {void} * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static _finalizeClass() { - super._finalizeClass(); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + polymerElementBase._finalizeClass.call(this); const observers = ownObservers(this); if (observers) { this.createObservers(observers, this._properties); @@ -350,6 +354,7 @@ export const ElementMixin = dedupingMixin(base => { this._prepareTemplate(); } + /** @nocollapse */ static _prepareTemplate() { // note: create "working" template that is finalized at instance time let template = /** @type {PolymerElementConstructor} */ (this).template; @@ -371,6 +376,7 @@ export const ElementMixin = dedupingMixin(base => { * @param {!Object} props . * @return {void} * @protected + * @nocollapse */ static createProperties(props) { for (let p in props) { @@ -388,6 +394,7 @@ export const ElementMixin = dedupingMixin(base => { * reference is changed * @return {void} * @protected + * @nocollapse */ static createObservers(observers, dynamicFns) { const proto = this.prototype; @@ -431,6 +438,7 @@ export const ElementMixin = dedupingMixin(base => { * } * * @return {!HTMLTemplateElement|string} Template to be stamped + * @nocollapse */ static get template() { // Explanation of template-related properties: @@ -488,6 +496,7 @@ export const ElementMixin = dedupingMixin(base => { * * @return {string} The import path for this element class * @suppress {missingProperties} + * @nocollapse */ static get importPath() { if (!this.hasOwnProperty(JSCompiler_renameProperty('_importPath', this))) { @@ -572,6 +581,7 @@ export const ElementMixin = dedupingMixin(base => { * @param {string} baseURI Base URI to rebase CSS paths against * @return {string} The processed CSS text * @protected + * @nocollapse */ static _processStyleText(cssText, baseURI) { return resolveCss(cssText, baseURI); @@ -585,6 +595,7 @@ export const ElementMixin = dedupingMixin(base => { * @param {string} is Tag name (or type extension name) for this element * @return {void} * @protected + * @nocollapse */ static _finalizeTemplate(is) { /** @const {HTMLTemplateElement} */ @@ -751,10 +762,14 @@ export const ElementMixin = dedupingMixin(base => { * @param {!NodeInfo} nodeInfo Node metadata for current template. * @return {boolean} . * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static _parseTemplateContent(template, templateInfo, nodeInfo) { templateInfo.dynamicFns = templateInfo.dynamicFns || this._properties; - return super._parseTemplateContent(template, templateInfo, nodeInfo); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + return polymerElementBase._parseTemplateContent.call( + this, template, templateInfo, nodeInfo); } /** @@ -767,6 +782,7 @@ export const ElementMixin = dedupingMixin(base => { * @return {void} * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static _addTemplatePropertyEffect(templateInfo, prop, effect) { // Warn if properties are used in template without being declared. @@ -781,7 +797,10 @@ export const ElementMixin = dedupingMixin(base => { console.warn(`Property '${prop}' used in template but not declared in 'properties'; ` + `attribute will not be observed.`); } - return super._addTemplatePropertyEffect(templateInfo, prop, effect); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + return polymerElementBase._addTemplatePropertyEffect.call( + this, templateInfo, prop, effect); } } diff --git a/lib/mixins/mutable-data.js b/lib/mixins/mutable-data.js index 3c937b94e8..d38b5119b9 100644 --- a/lib/mixins/mutable-data.js +++ b/lib/mixins/mutable-data.js @@ -152,6 +152,7 @@ export const OptionalMutableData = dedupingMixin(superClass => { */ class OptionalMutableData extends superClass { + /** @nocollapse */ static get properties() { return { /** diff --git a/lib/mixins/properties-changed.js b/lib/mixins/properties-changed.js index 78ec739ae2..94147a436c 100644 --- a/lib/mixins/properties-changed.js +++ b/lib/mixins/properties-changed.js @@ -55,6 +55,7 @@ export const PropertiesChanged = dedupingMixin( * @param {!Object} props Object whose keys are names of accessors. * @return {void} * @protected + * @nocollapse */ static createProperties(props) { const proto = this.prototype; @@ -74,6 +75,7 @@ export const PropertiesChanged = dedupingMixin( * @return {string} Attribute name corresponding to the given property. * * @protected + * @nocollapse */ static attributeNameForProperty(property) { return property.toLowerCase(); @@ -85,6 +87,7 @@ export const PropertiesChanged = dedupingMixin( * @param {string} name Name of property * * @protected + * @nocollapse */ static typeForProperty(name) { } //eslint-disable-line no-unused-vars diff --git a/lib/mixins/properties-mixin.js b/lib/mixins/properties-mixin.js index 871937bac2..67ebb9b509 100644 --- a/lib/mixins/properties-mixin.js +++ b/lib/mixins/properties-mixin.js @@ -113,6 +113,7 @@ export const PropertiesMixin = dedupingMixin(superClass => { * Implements standard custom elements getter to observes the attributes * listed in `properties`. * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static get observedAttributes() { if (!this.hasOwnProperty('__observedAttributes')) { @@ -129,6 +130,7 @@ export const PropertiesMixin = dedupingMixin(superClass => { * accessors exist on the element prototype. This method calls * `_finalizeClass` to finalize each constructor in the prototype chain. * @return {void} + * @nocollapse */ static finalize() { if (!this.hasOwnProperty(JSCompiler_renameProperty('__finalized', this))) { @@ -147,6 +149,7 @@ export const PropertiesMixin = dedupingMixin(superClass => { * `finalize` and finalizes the class constructor. * * @protected + * @nocollapse */ static _finalizeClass() { const props = ownProperties(/** @type {!PropertiesMixinConstructor} */(this)); @@ -162,6 +165,7 @@ export const PropertiesMixin = dedupingMixin(superClass => { * * @return {Object} Object containing properties for this class * @protected + * @nocollapse */ static get _properties() { if (!this.hasOwnProperty( @@ -181,6 +185,7 @@ export const PropertiesMixin = dedupingMixin(superClass => { * @return {*} Type to which to deserialize attribute * * @protected + * @nocollapse */ static typeForProperty(name) { const info = this._properties[name]; diff --git a/lib/mixins/property-accessors.js b/lib/mixins/property-accessors.js index bfa7f33a7e..26dcc95ffc 100644 --- a/lib/mixins/property-accessors.js +++ b/lib/mixins/property-accessors.js @@ -119,6 +119,7 @@ export const PropertyAccessors = dedupingMixin(superClass => { * `camelCase` convention * * @return {void} + * @nocollapse */ static createPropertiesForAttributes() { let a$ = this.observedAttributes; @@ -134,6 +135,7 @@ export const PropertyAccessors = dedupingMixin(superClass => { * @return {string} Attribute name corresponding to the given property. * * @protected + * @nocollapse */ static attributeNameForProperty(property) { return camelToDashCase(property); diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index bff06951fd..c12c9870d7 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -2267,6 +2267,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @param {Object=} effect Effect metadata object * @return {void} * @protected + * @nocollapse */ static addPropertyEffect(property, type, effect) { this.prototype._addPropertyEffect(property, type, effect); @@ -2281,6 +2282,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * a dependency to the effect. * @return {void} * @protected + * @nocollapse */ static createPropertyObserver(property, method, dynamicFn) { this.prototype._createPropertyObserver(property, method, dynamicFn); @@ -2298,6 +2300,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @return {void} * whether method names should be included as a dependency to the effect. * @protected + * @nocollapse */ static createMethodObserver(expression, dynamicFn) { this.prototype._createMethodObserver(expression, dynamicFn); @@ -2310,6 +2313,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @param {string} property Property name * @return {void} * @protected + * @nocollapse */ static createNotifyingProperty(property) { this.prototype._createNotifyingProperty(property); @@ -2330,6 +2334,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * when `true`. * @return {void} * @protected + * @nocollapse */ static createReadOnlyProperty(property, protectedSetter) { this.prototype._createReadOnlyProperty(property, protectedSetter); @@ -2342,6 +2347,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @param {string} property Property name * @return {void} * @protected + * @nocollapse */ static createReflectedProperty(property) { this.prototype._createReflectedProperty(property); @@ -2360,6 +2366,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * method names should be included as a dependency to the effect. * @return {void} * @protected + * @nocollapse */ static createComputedProperty(property, expression, dynamicFn) { this.prototype._createComputedProperty(property, expression, dynamicFn); @@ -2376,6 +2383,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * bindings * @return {!TemplateInfo} Template metadata object * @protected + * @nocollapse */ static bindTemplate(template) { return this.prototype._bindTemplate(template); @@ -2444,6 +2452,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @param {Object=} effect Effect metadata object * @return {void} * @protected + * @nocollapse */ static _addTemplatePropertyEffect(templateInfo, prop, effect) { let hostProps = templateInfo.hostProps = templateInfo.hostProps || {}; @@ -2548,9 +2557,13 @@ export const PropertyEffects = dedupingMixin(superClass => { * metadata to `nodeInfo` * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static _parseTemplateNode(node, templateInfo, nodeInfo) { - let noted = super._parseTemplateNode(node, templateInfo, nodeInfo); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + let noted = propertyEffectsBase._parseTemplateNode.call( + this, node, templateInfo, nodeInfo); if (node.nodeType === Node.TEXT_NODE) { let parts = this._parseBindings(node.textContent, templateInfo); if (parts) { @@ -2582,6 +2595,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * metadata to `nodeInfo` * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { let parts = this._parseBindings(value, templateInfo); @@ -2627,7 +2641,10 @@ export const PropertyEffects = dedupingMixin(superClass => { addBinding(this, templateInfo, nodeInfo, kind, name, parts, literal); return true; } else { - return super._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + return propertyEffectsBase._parseTemplateNodeAttribute.call( + this, node, templateInfo, nodeInfo, name, value); } } @@ -2643,9 +2660,13 @@ export const PropertyEffects = dedupingMixin(superClass => { * metadata to `nodeInfo` * @protected * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do + * @nocollapse */ static _parseTemplateNestedTemplate(node, templateInfo, nodeInfo) { - let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo); + // TODO(https://github.com/google/closure-compiler/issues/3240): + // Change back to just super.methodCall() + let noted = propertyEffectsBase._parseTemplateNestedTemplate.call( + this, node, templateInfo, nodeInfo); // Merge host props into outer template and add bindings let hostProps = nodeInfo.templateInfo.hostProps; let mode = '{'; @@ -2699,6 +2720,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @param {Object} templateInfo Current template metadata * @return {Array} Array of binding part metadata * @protected + * @nocollapse */ static _parseBindings(text, templateInfo) { let parts = []; @@ -2780,6 +2802,7 @@ export const PropertyEffects = dedupingMixin(superClass => { * @param {boolean} hasPaths True with `props` contains one or more paths * @return {*} Value the binding part evaluated to * @protected + * @nocollapse */ static _evaluateBinding(inst, part, path, props, oldProps, hasPaths) { let value; diff --git a/lib/mixins/template-stamp.js b/lib/mixins/template-stamp.js index 3ae0607e01..57ec46b67b 100644 --- a/lib/mixins/template-stamp.js +++ b/lib/mixins/template-stamp.js @@ -194,6 +194,7 @@ export const TemplateStamp = dedupingMixin( * @param {TemplateInfo=} outerTemplateInfo Template metadata from the outer * template, for parsing nested templates * @return {!TemplateInfo} Parsed template metadata + * @nocollapse */ static _parseTemplate(template, outerTemplateInfo) { // since a template may be re-used, memo-ize metadata @@ -208,6 +209,7 @@ export const TemplateStamp = dedupingMixin( return template._templateInfo; } + /** @nocollapse */ static _parseTemplateContent(template, templateInfo, nodeInfo) { return this._parseTemplateNode(template.content, templateInfo, nodeInfo); } @@ -224,6 +226,7 @@ export const TemplateStamp = dedupingMixin( * @param {!NodeInfo} nodeInfo Node metadata for current template. * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` + * @nocollapse */ static _parseTemplateNode(node, templateInfo, nodeInfo) { let noted; @@ -311,6 +314,7 @@ export const TemplateStamp = dedupingMixin( * @param {!NodeInfo} nodeInfo Node metadata for current template. * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` + * @nocollapse */ static _parseTemplateNestedTemplate(node, outerTemplateInfo, nodeInfo) { let templateInfo = this._parseTemplate(node, outerTemplateInfo); @@ -330,6 +334,7 @@ export const TemplateStamp = dedupingMixin( * @param {NodeInfo} nodeInfo Node metadata for current template. * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` + * @nocollapse */ static _parseTemplateNodeAttributes(node, templateInfo, nodeInfo) { // Make copy of original attribute list, since the order may change @@ -356,6 +361,7 @@ export const TemplateStamp = dedupingMixin( * @param {string} value Attribute value * @return {boolean} `true` if the visited node added node-specific * metadata to `nodeInfo` + * @nocollapse */ static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { // events (on-*) @@ -385,6 +391,7 @@ export const TemplateStamp = dedupingMixin( * * @param {HTMLTemplateElement} template Template to retrieve `content` for * @return {DocumentFragment} Content fragment + * @nocollapse */ static _contentForTemplate(template) { let templateInfo = /** @type {HTMLTemplateElementWithInfo} */ (template)._templateInfo;