|
|
|
@ -9,7 +9,7 @@ export default function visitEachBlock(
|
|
|
|
|
node: Node
|
|
|
|
|
) {
|
|
|
|
|
block.contextualise(node.expression);
|
|
|
|
|
const { dependencies, snippet } = node.metadata;
|
|
|
|
|
const { snippet } = node.metadata;
|
|
|
|
|
|
|
|
|
|
const open = `\${ ${node.else ? `${snippet}.length ? ` : ''}${snippet}.map(${node.index ? `(${node.context}, ${node.index})` : `(${node.context})`} => \``;
|
|
|
|
|
generator.append(open);
|
|
|
|
@ -22,20 +22,15 @@ export default function visitEachBlock(
|
|
|
|
|
const indexes = new Map(block.indexes);
|
|
|
|
|
if (node.index) indexes.set(node.index, node.context);
|
|
|
|
|
|
|
|
|
|
const contextDependencies = new Map(block.contextDependencies);
|
|
|
|
|
contextDependencies.set(node.context, dependencies);
|
|
|
|
|
|
|
|
|
|
if (node.destructuredContexts) {
|
|
|
|
|
for (let i = 0; i < node.destructuredContexts.length; i += 1) {
|
|
|
|
|
contexts.set(node.destructuredContexts[i], `${node.context}[${i}]`);
|
|
|
|
|
contextDependencies.set(node.destructuredContexts[i], dependencies);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const childBlock = block.child({
|
|
|
|
|
contexts,
|
|
|
|
|
indexes,
|
|
|
|
|
contextDependencies,
|
|
|
|
|
indexes
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
node.children.forEach((child: Node) => {
|
|
|
|
|