mirror of https://github.com/sveltejs/svelte
parent
e6cd4265eb
commit
ea139370de
@ -0,0 +1,14 @@
|
||||
/** @import { AwaitExpression } from 'estree' */
|
||||
/** @import { Context } from '../types' */
|
||||
|
||||
/**
|
||||
* @param {AwaitExpression} node
|
||||
* @param {Context} context
|
||||
*/
|
||||
export function AwaitExpression(node, context) {
|
||||
if (context.state.expression) {
|
||||
context.state.expression.is_async = true;
|
||||
}
|
||||
|
||||
context.next();
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/** @import { AwaitExpression, Expression } from 'estree' */
|
||||
/** @import { ComponentContext } from '../types' */
|
||||
import * as b from '../../../../utils/builders.js';
|
||||
|
||||
/**
|
||||
* @param {AwaitExpression} node
|
||||
* @param {ComponentContext} context
|
||||
*/
|
||||
export function AwaitExpression(node, context) {
|
||||
return b.await(
|
||||
b.call(
|
||||
'$.preserve_context',
|
||||
node.argument && /** @type {Expression} */ (context.visit(node.argument))
|
||||
)
|
||||
);
|
||||
}
|
Loading…
Reference in new issue