Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jan 24, 2025
1 parent e43509c commit c8a3d17
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion packages/svelte/src/compiler/phases/2-analyze/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ export function analyze_component(root, source, options) {
undefined_exports: new Map(),
snippet_renderers: new Map(),
snippets: new Set(),
is_async: false,
async_deriveds: new Set(),
suspenders: new Map()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ export function CallExpression(node, context) {

if (expression.is_async) {
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') {
context.next({ ...context.state, function_depth: context.state.function_depth + 1 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export function client_component(analysis, options) {
.../** @type {ESTree.Statement[]} */ (template.body)
]);

if (analysis.is_async) {
if (analysis.instance.is_async) {
const body = b.function_declaration(
b.id('$$body'),
[b.id('$$anchor'), b.id('$$props')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ export function Fragment(node, context) {
body.push(close);
}

const async =
state.metadata.async.length > 0 || (state.analysis.is_async && context.path.length === 0);

return b.block(body);
}

Expand Down
4 changes: 0 additions & 4 deletions packages/svelte/src/compiler/phases/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ export interface ComponentAnalysis extends Analysis {
* Every snippet that is declared locally
*/
snippets: Set<AST.SnippetBlock>;
/**
* true if uses top-level await
*/
is_async: boolean;
}

declare module 'estree' {
Expand Down

0 comments on commit c8a3d17

Please sign in to comment.