mirror of https://github.com/sveltejs/svelte
parent
eda1dd9bec
commit
3f06b6cf5d
@ -1,16 +1,22 @@
|
||||
/** @import { BlockStatement } from 'estree' */
|
||||
/** @import { AST } from '#compiler' */
|
||||
/** @import { ComponentContext } from '../types.js' */
|
||||
import { empty_comment } from './shared/utils.js';
|
||||
import { block_close, block_open, empty_comment } from './shared/utils.js';
|
||||
|
||||
/**
|
||||
* @param {AST.KeyBlock} node
|
||||
* @param {ComponentContext} context
|
||||
*/
|
||||
export function KeyBlock(node, context) {
|
||||
const is_async = node.metadata.expression.is_async();
|
||||
|
||||
if (is_async) context.state.template.push(block_open);
|
||||
|
||||
context.state.template.push(
|
||||
empty_comment,
|
||||
/** @type {BlockStatement} */ (context.visit(node.fragment)),
|
||||
empty_comment
|
||||
);
|
||||
|
||||
if (is_async) context.state.template.push(block_close);
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue