chore: remove snippet and is_async

pull/16762/head
S. Elliott Johnson 1 week ago
parent e3b0f80b7c
commit d6c7f58e69

@ -12,7 +12,6 @@ export function create_fragment(transparent = false) {
transparent,
dynamic: false,
has_await: false,
is_async: false,
// name is added later, after we've done scope analysis
hoisted_promises: { name: '', promises: [] }
}

@ -306,7 +306,6 @@ export function analyze_module(source, options) {
has_props_rune: false,
options: /** @type {ValidatedCompileOptions} */ (options),
fragment: null,
snippet: null,
title: null,
boundary: null,
parent_element: null,
@ -700,7 +699,6 @@ export function analyze_component(root, source, options) {
options,
ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module',
fragment: ast === template.ast ? ast : null,
snippet: null,
title: null,
boundary: null,
parent_element: null,
@ -770,7 +768,6 @@ export function analyze_component(root, source, options) {
analysis,
options,
fragment: ast === template.ast ? ast : null,
snippet: null,
title: null,
boundary: null,
parent_element: null,

@ -9,7 +9,6 @@ export interface AnalysisState {
options: ValidatedCompileOptions;
ast_type: 'instance' | 'template' | 'module';
fragment: AST.Fragment | null;
snippet: AST.SnippetBlock | null;
title: AST.TitleElement | null;
boundary: AST.SvelteBoundary | null;
/**

@ -17,24 +17,21 @@ export function AwaitExpression(node, context) {
context.state.fragment.metadata.has_await = true;
}
suspend = true;
}
if (context.state.async_hoist_boundary) {
const len = context.state.async_hoist_boundary.metadata.hoisted_promises.promises.push(
node.argument
);
context.state.analysis.hoisted_promises.set(
node.argument,
b.member(
b.id(context.state.async_hoist_boundary.metadata.hoisted_promises.name),
b.literal(len - 1),
true
)
);
}
// Only set has_await on the boundary when we're in a template expression context
// (not in event handlers or other non-template contexts)
if (context.state.async_hoist_boundary && context.state.expression) {
context.state.async_hoist_boundary.metadata.is_async = true;
const len = context.state.async_hoist_boundary.metadata.hoisted_promises.promises.push(
node.argument
);
context.state.analysis.hoisted_promises.set(
node.argument,
b.member(
b.id(context.state.async_hoist_boundary.metadata.hoisted_promises.name),
b.literal(len - 1),
true
)
);
suspend = true;
}
if (context.state.title) {

@ -26,7 +26,6 @@ export function SnippetBlock(node, context) {
context.next({
...context.state,
parent_element: null,
snippet: node,
async_hoist_boundary: node.body
});

@ -52,11 +52,7 @@ export function Fragment(node, context) {
b.stmt(
b.call(
'$$payload.child',
b.arrow(
[b.id('$$payload')],
b.block(build_template(state.template)),
node.metadata.is_async
)
b.arrow([b.id('$$payload')], b.block(build_template(state.template)), true)
)
)
]);

@ -57,10 +57,6 @@ export namespace AST {
*/
dynamic: boolean;
has_await: boolean;
/**
* True when this fragment has a top-level `await` expression.
*/
is_async: boolean;
hoisted_promises: { name: string; promises: Expression[] };
};
}

Loading…
Cancel
Save