|
|
|
|
@ -1444,19 +1444,14 @@ const template_visitors = {
|
|
|
|
|
},
|
|
|
|
|
SnippetBlock(node, context) {
|
|
|
|
|
// TODO hoist where possible
|
|
|
|
|
/** @type {import('estree').Pattern[]} */
|
|
|
|
|
const args = [b.id('$$payload')];
|
|
|
|
|
for (const arg of node.parameters) {
|
|
|
|
|
if (arg) args.push(arg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context.state.init.push(
|
|
|
|
|
b.function_declaration(
|
|
|
|
|
node.expression,
|
|
|
|
|
args,
|
|
|
|
|
[b.id('$$payload'), ...node.parameters],
|
|
|
|
|
/** @type {import('estree').BlockStatement} */ (context.visit(node.body))
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (context.state.options.dev) {
|
|
|
|
|
context.state.init.push(b.stmt(b.call('$.add_snippet_symbol', node.expression)));
|
|
|
|
|
}
|
|
|
|
|
|