From 24b6fab58b92e02703f9200d727d124493a020c9 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 24 Jan 2025 18:49:11 -0500 Subject: [PATCH] chore: construct analysis before module walk (#15108) --- .../src/compiler/phases/2-analyze/index.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/svelte/src/compiler/phases/2-analyze/index.js b/packages/svelte/src/compiler/phases/2-analyze/index.js index 76c1e94277..c65eb5f955 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/index.js +++ b/packages/svelte/src/compiler/phases/2-analyze/index.js @@ -243,7 +243,15 @@ export function analyze_module(ast, options) { } } - const analysis = { runes: true, tracing: false }; + /** @type {Analysis} */ + const analysis = { + module: { ast, scope, scopes }, + name: options.filename, + accessors: false, + runes: true, + immutable: true, + tracing: false + }; walk( /** @type {Node} */ (ast), @@ -256,14 +264,7 @@ export function analyze_module(ast, options) { visitors ); - return { - module: { ast, scope, scopes }, - name: options.filename, - accessors: false, - runes: true, - immutable: true, - tracing: analysis.tracing - }; + return analysis; } /**