|
|
@ -1,7 +1,7 @@
|
|
|
|
/** @import { BlockStatement, Pattern, Statement } from 'estree' */
|
|
|
|
/** @import { BlockStatement, Pattern, Statement } from 'estree' */
|
|
|
|
/** @import { AST } from '#compiler' */
|
|
|
|
/** @import { AST } from '#compiler' */
|
|
|
|
/** @import { ComponentClientTransformState, ComponentContext } from '../types' */
|
|
|
|
/** @import { ComponentClientTransformState, ComponentContext } from '../types' */
|
|
|
|
import { extract_identifiers } from '../../../../utils/ast.js';
|
|
|
|
import { extract_identifiers, is_expression_async } from '../../../../utils/ast.js';
|
|
|
|
import * as b from '#compiler/builders';
|
|
|
|
import * as b from '#compiler/builders';
|
|
|
|
import { create_derived } from '../utils.js';
|
|
|
|
import { create_derived } from '../utils.js';
|
|
|
|
import { get_value } from './shared/declarations.js';
|
|
|
|
import { get_value } from './shared/declarations.js';
|
|
|
@ -15,7 +15,11 @@ export function AwaitBlock(node, context) {
|
|
|
|
context.state.template.push_comment();
|
|
|
|
context.state.template.push_comment();
|
|
|
|
|
|
|
|
|
|
|
|
// Visit {#await <expression>} first to ensure that scopes are in the correct order
|
|
|
|
// Visit {#await <expression>} first to ensure that scopes are in the correct order
|
|
|
|
const expression = b.thunk(build_expression(context, node.expression, node.metadata.expression));
|
|
|
|
const unthunked = build_expression(context, node.expression, node.metadata.expression);
|
|
|
|
|
|
|
|
const expression = b.thunk(
|
|
|
|
|
|
|
|
unthunked,
|
|
|
|
|
|
|
|
context.state.options.experimental.async && is_expression_async(unthunked)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
let then_block;
|
|
|
|
let then_block;
|
|
|
|
let catch_block;
|
|
|
|
let catch_block;
|
|
|
|