Skip to content

Commit

Permalink
Fix more closure warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Apr 26, 2017
1 parent f1a1498 commit fa9823f
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 515 deletions.
586 changes: 110 additions & 476 deletions closure.log

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions externs/closure-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ Polymer_TemplateStamp.prototype._removeEventListenerFromNode = function(node, ev
function Polymer_PropertyEffects(){}
/**
* @override
*/
Polymer_PropertyEffects.prototype._initializeProperties = function(){};
/**
* @override
* @param {*} props
*/
Polymer_PropertyEffects.prototype._initializeProtoProperties = function(props){};
Expand Down
2 changes: 1 addition & 1 deletion lib/elements/dom-bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @constructor
* @implements {Polymer_PropertyEffects}
* @implements {Polymer_OptionalMutableData}
* @implements {Polymer_GestureEventListener}
* @implements {Polymer_GestureEventListeners}
* @extends {HTMLElement}
*/
const domBindBase =
Expand Down
15 changes: 15 additions & 0 deletions lib/legacy/templatizer-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
(function() {
'use strict';

let TemplateInstanceBase = Polymer.TemplateInstanceBase; // eslint-disable-line
/**
* @typedef {{
* _parentModel: boolean,
* _instanceProps: Object,
* _forwardHostPropV2: Function,
* _notifyInstancePropV2: Function,
* ctor: TemplateInstanceBase
* }}
*/
let TemplatizerUser; // eslint-disable-line

/**
* The `Polymer.Templatizer` behavior adds methods to generate instances of
* templates that are each managed by an anonymous `Polymer.PropertyEffects`
Expand Down Expand Up @@ -87,6 +99,7 @@
* @param {boolean=} mutableData When `true`, the generated class will skip
* strict dirty-checking for objects and arrays (always consider them to
* be "dirty"). Defaults to false.
* @this {TemplatizerUser}
*/
templatize(template, mutableData) {
this._templatizerTemplate = template;
Expand All @@ -110,6 +123,7 @@
* populate into the template bindings.
* @return {TemplateInstanceBase} Returns the created instance of
* the template prepared by `templatize`.
* @this {Polymer_LegacyElementMixin}
*/
stamp(model) {
return new this.ctor(model);
Expand All @@ -124,6 +138,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}
*/
modelForElement(el) {
return Polymer.Templatize.modelForElement(this._templatizerTemplate, el);
Expand Down
15 changes: 7 additions & 8 deletions lib/mixins/property-accessors.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@

constructor() {
super();
this.__serializing = false;
this.__dataCounter = 0;
this.__dataInitialized = false;
this.__dataInvalid = false;
this.__data = {};
this.__dataPending = null;
this.__dataOld = null;
this._initializeProperties();
}

Expand All @@ -135,14 +142,6 @@
* @protected
*/
_initializeProperties() {
this.__serializing = false;
this.__dataCounter = 0;
this.__dataInitialized = false;
this.__dataInvalid = false;
// initialize data with prototype values saved when creating accessors
this.__data = {};
this.__dataPending = null;
this.__dataOld = null;
if (this.__dataProto) {
this._initializeProtoProperties(this.__dataProto);
this.__dataProto = null;
Expand Down
12 changes: 3 additions & 9 deletions lib/mixins/property-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -1073,15 +1073,8 @@
return TYPES;
}

/**
* Overrides `Polymer.PropertyAccessors` implementation to initialize
* additional property-effect related properties.
*
* @override
*/
_initializeProperties() {
super._initializeProperties();
this.__dataClientsInitialized = false;
constructor() {
super();
this.__dataPendingClients = null;
this.__dataToNotify = null;
this.__dataLinkedPaths = null;
Expand All @@ -1090,6 +1083,7 @@
this.__dataCompoundStorage = this.__dataCompoundStorage || null;
this.__dataHost = this.__dataHost || null;
this.__dataTemp = {};
this.__dataClientsInitialized = false;
}

/**
Expand Down
37 changes: 20 additions & 17 deletions lib/utils/templatize.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* @implements {Polymer_PropertyEffects}
*/
const base = Polymer.PropertyEffects(class {});
/** @unrestricted */
class TemplateInstanceBase extends base {
constructor(props) {
super();
Expand Down Expand Up @@ -190,7 +191,7 @@
* is either another templatize instance that had option `parentModel: true`,
* or else the host element.
*
* @return {Polymer.PropertyEffectsInterface} The parent model of this instance
* @return {Polymer_PropertyEffects} The parent model of this instance
*/
get parentModel() {
let model = this.__parentModel;
Expand All @@ -207,19 +208,22 @@
return model;
}
}
/** @type {HTMLTemplateElement} */
/** @type {DataTemplate} */
TemplateInstanceBase.prototype.__dataHost = null;
/** @type {Object} */
TemplateInstanceBase.prototype.__templatizeOptions = null;
/** @type {Object} */
/** @type {Polymer_PropertyEffects} */
TemplateInstanceBase.prototype._methodHost = null;
/** @type {Object} */
TemplateInstanceBase.prototype.__dataHost = null;
/** @type {Object} */
TemplateInstanceBase.prototype.__templatizeOwner = null;
/** @type {Object} */
TemplateInstanceBase.prototype.__hostProps = null;

/**
* @constructor
* @extends {TemplateInstanceBase}
* @implements {Polymer_MutableData}
*/
const MutableTemplateInstanceBase = Polymer.MutableData(TemplateInstanceBase);

function findMethodHost(template) {
Expand All @@ -234,9 +238,7 @@

function createTemplatizerClass(template, templateInfo, options) {
// Anonymous class created by the templatize
/**
* @unrestricted
*/
/** @unrestricted */
let base = options.mutableData ?
MutableTemplateInstanceBase : TemplateInstanceBase;
let klass = class extends base { }
Expand Down Expand Up @@ -416,9 +418,9 @@
*
* @memberof Polymer.Templatize
* @param {HTMLTemplateElement} template Template to templatize
* @param {*} owner Owner of the template instances; any optional callbacks
* will be bound to this owner.
* @param {*=} options Options dictionary (see summary for details)
* @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 {TemplateInstanceBase} Generated class bound to the template
* provided
*/
Expand Down Expand Up @@ -464,35 +466,36 @@
* @memberof Polymer.Templatize
* @param {HTMLTemplateElement} template The model will be returned for
* elements stamped from this template
* @param {HTMLElement} el Element for which to return a template model.
* @param {Node} node Node for which to return a template model.
* @return {TemplateInstanceBase} Template instance representing the
* binding scope for the element
*/
modelForElement(template, el) {
modelForElement(template, node) {
let model;
while (el) {
while (node) {
// An element with a __templatizeInstance marks the top boundary
// of a scope; walk up until we find one, and then ensure that
// its __dataHost matches `this`, meaning this dom-repeat stamped it
if ((model = el.__templatizeInstance)) {
if ((model = node.__templatizeInstance)) {
// Found an element stamped by another template; keep walking up
// from its __dataHost
if (model.__dataHost != template) {
el = model.__dataHost;
node = model.__dataHost;
} else {
return model;
}
} else {
// Still in a template scope, keep going up until
// a __templatizeInstance is found
el = el.parentNode;
node = node.parentNode;
}
}
return null;
}
}

Polymer.Templatize = Templatize;
Polymer.TemplateInstanceBase = TemplateInstanceBase;

})();

Expand Down

0 comments on commit fa9823f

Please sign in to comment.