aaa
Rich Harris 7 months ago
parent e43509c64b
commit c8a3d17cfd

@ -460,7 +460,6 @@ export function analyze_component(root, source, options) {
undefined_exports: new Map(), undefined_exports: new Map(),
snippet_renderers: new Map(), snippet_renderers: new Map(),
snippets: new Set(), snippets: new Set(),
is_async: false,
async_deriveds: new Set(), async_deriveds: new Set(),
suspenders: new Map() suspenders: new Map()
}; };

@ -207,9 +207,6 @@ export function CallExpression(node, context) {
if (expression.is_async) { if (expression.is_async) {
context.state.analysis.async_deriveds.add(node); context.state.analysis.async_deriveds.add(node);
context.state.analysis.is_async ||=
context.state.ast_type === 'instance' && context.state.function_depth === 1;
} }
} else if (rune === '$inspect') { } else if (rune === '$inspect') {
context.next({ ...context.state, function_depth: context.state.function_depth + 1 }); context.next({ ...context.state, function_depth: context.state.function_depth + 1 });

@ -367,7 +367,7 @@ export function client_component(analysis, options) {
.../** @type {ESTree.Statement[]} */ (template.body) .../** @type {ESTree.Statement[]} */ (template.body)
]); ]);
if (analysis.is_async) { if (analysis.instance.is_async) {
const body = b.function_declaration( const body = b.function_declaration(
b.id('$$body'), b.id('$$body'),
[b.id('$$anchor'), b.id('$$props')], [b.id('$$anchor'), b.id('$$props')],

@ -197,9 +197,6 @@ export function Fragment(node, context) {
body.push(close); body.push(close);
} }
const async =
state.metadata.async.length > 0 || (state.analysis.is_async && context.path.length === 0);
return b.block(body); return b.block(body);
} }

@ -99,10 +99,6 @@ export interface ComponentAnalysis extends Analysis {
* Every snippet that is declared locally * Every snippet that is declared locally
*/ */
snippets: Set<AST.SnippetBlock>; snippets: Set<AST.SnippetBlock>;
/**
* true if uses top-level await
*/
is_async: boolean;
} }
declare module 'estree' { declare module 'estree' {

Loading…
Cancel
Save