remove async_hoist_boundary

pull/16757/head
Rich Harris 1 week ago
parent 48b766cc46
commit 9a273c6af2

@ -309,8 +309,7 @@ export function analyze_module(source, options) {
title: null,
boundary: null,
parent_element: null,
reactive_statement: null,
async_hoist_boundary: null
reactive_statement: null
},
visitors
);
@ -709,8 +708,7 @@ export function analyze_component(root, source, options) {
expression: null,
state_fields: new Map(),
function_depth: scope.function_depth,
reactive_statement: null,
async_hoist_boundary: ast === template.ast ? ast : null
reactive_statement: null
};
walk(/** @type {AST.SvelteNode} */ (ast), state, visitors);
@ -779,8 +777,7 @@ export function analyze_component(root, source, options) {
component_slots: new Set(),
expression: null,
state_fields: new Map(),
function_depth: scope.function_depth,
async_hoist_boundary: ast === template.ast ? ast : null
function_depth: scope.function_depth
};
walk(/** @type {AST.SvelteNode} */ (ast), state, visitors);

@ -11,14 +11,6 @@ export interface AnalysisState {
fragment: AST.Fragment | null;
title: AST.TitleElement | null;
boundary: AST.SvelteBoundary | null;
/**
* The "anchor" fragment for any hoisted promises. This is the root fragment when
* walking starts and until another boundary fragment is encountered, like a
* consequent or alternate of an `#if` or `#each` block. When this fragment is emitted
* during server transformation, the promise expressions will be hoisted out of the fragment
* and placed right above it in an array.
*/
async_hoist_boundary: AST.Fragment | null;
/**
* Tag name of the parent element. `null` if the parent is `svelte:element`, `#snippet`, a component or the root.
* Parent doesn't necessarily mean direct path predecessor because there could be `#each`, `#if` etc in-between.

@ -44,22 +44,7 @@ export function AwaitBlock(node, context) {
// this one doesn't get the new state because it still hoists to the existing scope
context.visit(node.expression, { ...context.state, expression: node.metadata.expression });
if (node.pending) {
context.visit(node.pending, {
...context.state,
async_hoist_boundary: node.pending
});
}
if (node.then) {
context.visit(node.then, {
...context.state,
async_hoist_boundary: node.then
});
}
if (node.catch) {
context.visit(node.catch, {
...context.state,
async_hoist_boundary: node.catch
});
}
if (node.pending) context.visit(node.pending);
if (node.then) context.visit(node.then);
if (node.catch) context.visit(node.catch);
}

@ -35,16 +35,10 @@ export function EachBlock(node, context) {
scope: /** @type {Scope} */ (context.state.scope.parent)
});
context.visit(node.body, {
...context.state,
async_hoist_boundary: node.body
});
context.visit(node.body);
if (node.key) context.visit(node.key);
if (node.fallback) {
context.visit(node.fallback, {
...context.state,
async_hoist_boundary: node.fallback
});
context.visit(node.fallback);
}
if (!context.state.analysis.runes) {

@ -22,14 +22,8 @@ export function IfBlock(node, context) {
expression: node.metadata.expression
});
context.visit(node.consequent, {
...context.state,
async_hoist_boundary: node.consequent
});
context.visit(node.consequent);
if (node.alternate) {
context.visit(node.alternate, {
...context.state,
async_hoist_boundary: node.alternate
});
context.visit(node.alternate);
}
}

@ -17,9 +17,5 @@ export function KeyBlock(node, context) {
mark_subtree_dynamic(context.path);
context.visit(node.expression, { ...context.state, expression: node.metadata.expression });
context.visit(node.fragment, {
...context.state,
async_hoist_boundary: node.fragment
});
context.visit(node.fragment);
}

@ -23,11 +23,7 @@ export function SnippetBlock(node, context) {
}
}
context.next({
...context.state,
parent_element: null,
async_hoist_boundary: node.body
});
context.next({ ...context.state, parent_element: null });
const can_hoist =
context.path.length === 1 &&

@ -34,9 +34,5 @@ export function SvelteBoundary(node, context) {
)
) ?? null;
context.next({
...context.state,
boundary: node,
async_hoist_boundary: node.fragment
});
context.next({ ...context.state, boundary: node });
}

Loading…
Cancel
Save