Lint and format src/compiler/compile/nodes/shared/map_children.js

pull/8569/head
Simon Holthausen 3 years ago
parent 9886954315
commit ca30dff13d

@ -77,25 +77,22 @@ function get_constructor(type) {
export default function map_children(component, parent, scope, children) { export default function map_children(component, parent, scope, children) {
let last = null; let last = null;
let ignores = []; let ignores = [];
return children.map(/** @param {any} child */ (child) => { return children.map(
/** @param {any} child */ (child) => {
const constructor = get_constructor(child.type); const constructor = get_constructor(child.type);
const use_ignores = child.type !== 'Text' && child.type !== 'Comment' && ignores.length; const use_ignores = child.type !== 'Text' && child.type !== 'Comment' && ignores.length;
if (use_ignores) if (use_ignores) component.push_ignores(ignores);
component.push_ignores(ignores);
const node = new constructor(component, parent, scope, child); const node = new constructor(component, parent, scope, child);
if (use_ignores) if (use_ignores) component.pop_ignores(), (ignores = []);
component.pop_ignores(), (ignores = []);
if (node.type === 'Comment' && node.ignores.length) { if (node.type === 'Comment' && node.ignores.length) {
push_array(ignores, node.ignores); push_array(ignores, node.ignores);
} }
if (last) if (last) last.next = node;
last.next = node;
node.prev = last; node.prev = last;
last = node; last = node;
return node; return node;
}); }
);
} }
/** @typedef {Class<map_children>>} Children */ /** @typedef {Class<map_children>>} Children */

Loading…
Cancel
Save