Skip to content

Commit

Permalink
Closure compilation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
aomarks committed Jun 16, 2019
1 parent 1b8263f commit 15090f2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/elements/dom-repeat.js
Expand Up @@ -297,7 +297,7 @@ export class DomRepeat extends domRepeatBase {
this.__sortFn = null;
this.__filterFn = null;
this.__observePaths = null;
/** @type {?function(new:TemplateInstanceBase, *)} */
/** @type {?function(new:TemplateInstanceBase, Object=)} */
this.__ctor = null;
this.__isDetached = true;
this.template = null;
Expand Down
1 change: 0 additions & 1 deletion lib/legacy/mutable-data-behavior.js
Expand Up @@ -141,7 +141,6 @@ export const OptionalMutableDataBehavior = {
* @param {*} value New property value
* @param {*} old Previous property value
* @return {boolean} Whether the property should be considered a change
* @this {this}
* @protected
*/
_shouldPropertyChange(property, value, old) {
Expand Down
17 changes: 9 additions & 8 deletions lib/legacy/templatizer-behavior.js
Expand Up @@ -16,7 +16,7 @@ import { TemplateInstanceBase, templatize, modelForElement } from '../utils/temp
* _instanceProps: Object,
* _forwardHostPropV2: Function,
* _notifyInstancePropV2: Function,
* ctor: TemplateInstanceBase
* ctor: function(new:TemplateInstanceBase, Object=)
* }}
*/
let TemplatizerUser; // eslint-disable-line
Expand Down Expand Up @@ -99,13 +99,14 @@ export const Templatizer = {
*/
templatize(template, mutableData) {
this._templatizerTemplate = template;
this.ctor = templatize(template, this, {
mutableData: Boolean(mutableData),
parentModel: this._parentModel,
instanceProps: this._instanceProps,
forwardHostProp: this._forwardHostPropV2,
notifyInstanceProp: this._notifyInstancePropV2
});
this.ctor =
templatize(template, /** @type {!Polymer_PropertyEffects} */ (this), {
mutableData: Boolean(mutableData),
parentModel: this._parentModel,
instanceProps: this._instanceProps,
forwardHostProp: this._forwardHostPropV2,
notifyInstanceProp: this._notifyInstancePropV2
});
},

/**
Expand Down
9 changes: 6 additions & 3 deletions lib/utils/templatize.js
Expand Up @@ -98,6 +98,7 @@ function upgradeTemplate(template, constructor) {
/**
* Base class for TemplateInstance.
* @constructor
* @extends {HTMLElement}
* @implements {Polymer_PropertyEffects}
* @private
*/
Expand All @@ -119,7 +120,9 @@ class TemplateInstanceBase extends templateInstanceBase {
/** @type {!StampedTemplate} */
this.root = this._stampTemplate(this.__dataHost);
// Save list of stamped children
let children = this.children = [];
let children = [];
/** @suppress {invalidCasts} */
this.children = /** @type {!NodeList} */ (children);
// Polymer 1.x did not use `Polymer.dom` here so not bothering.
for (let n = this.root.firstChild; n; n=n.nextSibling) {
children.push(n);
Expand Down Expand Up @@ -532,8 +535,8 @@ function createNotifyHostPropEffect() {
* @param {Polymer_PropertyEffects=} owner Owner of the template instances;
* any optional callbacks will be bound to this owner.
* @param {Object=} options Options dictionary (see summary for details)
* @return {function(new:TemplateInstanceBase)} Generated class bound to the template
* provided
* @return {function(new:TemplateInstanceBase, Object=)} Generated class bound
* to the template provided
* @suppress {invalidCasts}
*/
export function templatize(template, owner, options) {
Expand Down

0 comments on commit 15090f2

Please sign in to comment.