Don't have return /** comment */ lines

This breaks espree AST generation with automatic semicolon insertion and
becomes

```
return
/** comment */
thing;
```
This commit is contained in:
Daniel Freedman
2017-09-07 15:02:53 -07:00
parent e45e5bba1b
commit c802b8b2f3
7 changed files with 23 additions and 12 deletions

View File

@@ -42,7 +42,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
function mixinBehaviors(behaviors, klass) {
if (!behaviors) {
return /** @type {HTMLElement} */(klass);
klass = /** @type {HTMLElement} */(klass); // eslint-disable-line no-self-assign
return klass;
}
// NOTE: ensure the bahevior is extending a class with
// legacy element api. This is necessary since behaviors expect to be able

View File

@@ -479,7 +479,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @return {Array<Node>} List of effctive child nodes.
*/
getEffectiveChildNodes() {
return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).getEffectiveChildNodes();
const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(this));
return domApi.getEffectiveChildNodes();
}
/**
@@ -491,7 +492,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @return {Array<Node>} List of distributed elements that match selector.
*/
queryDistributedElements(selector) {
return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).queryDistributedElements(selector);
const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(this));
return domApi.queryDistributedElements(selector);
}
/**
@@ -581,9 +583,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @suppress {invalidCasts}
*/
getContentChildren(slctr) {
return /** @type {Array<HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) {
let children = /** @type {Array<HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) {
return (n.nodeType === Node.ELEMENT_NODE);
}));
return children;
}
/**

View File

@@ -205,7 +205,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
let name = properties[i];
Object.defineProperty(proto, name, {
get: function() {
return /** @type {DomApi} */ (this).node[name];
const domApi = /** @type {DomApi} */(this);
return domApi.node[name];
},
configurable: true
});
@@ -217,7 +218,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
let name = properties[i];
Object.defineProperty(proto, name, {
get: function() {
return /** @type {DomApi} */ (this).node[name];
const domApi = /** @type {DomApi} */(this);
return domApi.node[name];
},
set: function(value) {
/** @type {DomApi} */ (this).node[name] = value;

View File

@@ -429,7 +429,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
applyTemplateContent(this, node, info);
applyEventListener(this, node, info);
}
return /** @type {!StampedTemplate} */(dom);
dom = /** @type {!StampedTemplate} */(dom); // eslint-disable-line no-self-assign
return dom;
}
/**

View File

@@ -64,11 +64,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
static getFlattenedNodes(node) {
if (isSlot(node)) {
return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true});
node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign
return node.assignedNodes({flatten: true});
} else {
return Array.from(node.childNodes).map(node => {
return Array.from(node.childNodes).map((node) => {
if (isSlot(node)) {
return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true});
node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign
return node.assignedNodes({flatten: true});
} else {
return [node];
}

View File

@@ -289,7 +289,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_findOriginalTarget: function(ev) {
// shadowdom
if (ev.composedPath) {
return /** @type {EventTarget} */(ev.composedPath()[0]);
const target = /** @type {EventTarget} */(ev.composedPath()[0]);
return target;
}
// shadydom
return ev.target;

View File

@@ -466,7 +466,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
klass.prototype.__dataHost = template;
klass.prototype.__templatizeOwner = owner;
klass.prototype.__hostProps = templateInfo.hostProps;
return /** @type {function(new:TemplateInstanceBase)} */(klass);
klass = /** @type {function(new:TemplateInstanceBase)} */(klass); //eslint-disable-line no-self-assign
return klass;
},
/**