stop to use anonymous function

pull/6898/head
Yuichiro Yamashita 5 years ago
parent 9863c5e19c
commit b34b0ca6a6

@ -424,15 +424,18 @@ export default class ElementWrapper extends Wrapper {
.filter((attr) => !(attr instanceof SpreadAttributeWrapper) && !attr.property_name) .filter((attr) => !(attr instanceof SpreadAttributeWrapper) && !attr.property_name)
.map((attr) => p`${(attr as StyleAttributeWrapper | AttributeWrapper).name}: true`); .map((attr) => p`${(attr as StyleAttributeWrapper | AttributeWrapper).name}: true`);
const reference = (function (node) { let reference;
if (node.tag_expr.node.type === 'Literal') { if (this.node.tag_expr.node.type === 'Literal') {
if (node.namespace) return `"${node.tag_expr.node.value}"`; if (this.node.namespace) {
return `"${(node.tag_expr.node.value as String || '').toUpperCase()}"`; reference = `"${this.node.tag_expr.node.value}"`;
} else { } else {
if (node.namespace) return x`${node.tag_expr.manipulate(block)}`; reference = `"${(this.node.tag_expr.node.value as String || '').toUpperCase()}"`;
return x`(${node.tag_expr.manipulate(block)} || 'null').toUpperCase()`; }
} else if (this.node.namespace) {
reference = x`${this.node.tag_expr.manipulate(block)}`;
} else {
reference = x`(${this.node.tag_expr.manipulate(block)} || 'null').toUpperCase()`;
} }
}(this.node));
if (this.node.namespace === namespaces.svg) { if (this.node.namespace === namespaces.svg) {
return x`@claim_svg_element(${nodes}, ${reference}, { ${attributes} })`; return x`@claim_svg_element(${nodes}, ${reference}, { ${attributes} })`;

Loading…
Cancel
Save