|
|
|
@ -312,9 +312,10 @@ export function EachBlock(node, context) {
|
|
|
|
declarations.push(b.let(node.index, index));
|
|
|
|
declarations.push(b.let(node.index, index));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const { has_await } = node.metadata.expression;
|
|
|
|
const is_async = node.metadata.expression.is_async();
|
|
|
|
const get_collection = b.thunk(collection, has_await);
|
|
|
|
|
|
|
|
const thunk = has_await ? b.thunk(b.call('$.get', b.id('$$collection'))) : get_collection;
|
|
|
|
const get_collection = b.thunk(collection, node.metadata.expression.has_await);
|
|
|
|
|
|
|
|
const thunk = is_async ? b.thunk(b.call('$.get', b.id('$$collection'))) : get_collection;
|
|
|
|
|
|
|
|
|
|
|
|
const render_args = [b.id('$$anchor'), item];
|
|
|
|
const render_args = [b.id('$$anchor'), item];
|
|
|
|
if (uses_index || collection_id) render_args.push(index);
|
|
|
|
if (uses_index || collection_id) render_args.push(index);
|
|
|
|
@ -341,12 +342,13 @@ export function EachBlock(node, context) {
|
|
|
|
statements.unshift(b.stmt(b.call('$.validate_each_keys', thunk, key_function)));
|
|
|
|
statements.unshift(b.stmt(b.call('$.validate_each_keys', thunk, key_function)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (has_await) {
|
|
|
|
if (is_async) {
|
|
|
|
context.state.init.push(
|
|
|
|
context.state.init.push(
|
|
|
|
b.stmt(
|
|
|
|
b.stmt(
|
|
|
|
b.call(
|
|
|
|
b.call(
|
|
|
|
'$.async',
|
|
|
|
'$.async',
|
|
|
|
context.state.node,
|
|
|
|
context.state.node,
|
|
|
|
|
|
|
|
node.metadata.expression.blockers(),
|
|
|
|
b.array([get_collection]),
|
|
|
|
b.array([get_collection]),
|
|
|
|
b.arrow([context.state.node, b.id('$$collection')], b.block(statements))
|
|
|
|
b.arrow([context.state.node, b.id('$$collection')], b.block(statements))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|