Lint and format src/compiler/compile/render_ssr/handlers/IfBlock.js

pull/8569/head
Simon Holthausen 3 years ago
parent b8b2b58c4e
commit ac034d50ec

@ -14,18 +14,13 @@ export default function (node, renderer, options) {
/** @type {import('estree').Node} */
let consequent = renderer.pop();
if (node.const_tags.length > 0)
consequent = x `(() => { ${get_const_tags(node.const_tags)}; return ${consequent} })()`;
consequent = x`(() => { ${get_const_tags(node.const_tags)}; return ${consequent} })()`;
renderer.push();
if (node.else)
renderer.render(node.else.children, options);
if (node.else) renderer.render(node.else.children, options);
/** @type {import('estree').Node} */
let alternate = renderer.pop();
if (node.else && node.else.const_tags.length > 0)
alternate = x `(() => { ${get_const_tags(node.else.const_tags)}; return ${alternate} })()`;
renderer.add_expression(x `${condition} ? ${consequent} : ${alternate}`);
alternate = x`(() => { ${get_const_tags(node.else.const_tags)}; return ${alternate} })()`;
renderer.add_expression(x`${condition} ? ${consequent} : ${alternate}`);
}

Loading…
Cancel
Save