From 229ab371345ed7f818d24ea5a41d28301ca00c88 Mon Sep 17 00:00:00 2001 From: ComputerGuy <63362464+Ocean-OS@users.noreply.github.com> Date: Fri, 5 Sep 2025 14:42:13 -0700 Subject: [PATCH] tweak --- .../compiler/phases/3-transform/client/utils.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/svelte/src/compiler/phases/3-transform/client/utils.js b/packages/svelte/src/compiler/phases/3-transform/client/utils.js index aae95add35..51c27a62c7 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/utils.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/utils.js @@ -37,17 +37,16 @@ export function is_state_source(binding, analysis) { * @returns {boolean} */ export function can_be_parallelized(expression, scope, analysis, bindings) { - let has_closures = false; let should_stop = false; /** @type {Set} */ const references = new Set(); walk(/** @type {Node} */ (expression), null, { ArrowFunctionExpression(_, { stop }) { - has_closures = true; + should_stop = true; stop(); }, FunctionExpression(_, { stop }) { - has_closures = true; + should_stop = true; stop(); }, Identifier(node, { path }) { @@ -68,11 +67,11 @@ export function can_be_parallelized(expression, scope, analysis, bindings) { stop(); }, StaticBlock(node, { stop }) { - has_closures = true; + should_stop = true; stop(); } }); - if (has_closures || should_stop) { + if (should_stop) { return false; } for (const reference of references) { @@ -80,12 +79,13 @@ export function can_be_parallelized(expression, scope, analysis, bindings) { if (!binding || binding.declaration_kind === 'import') { return false; } - if ('template' in analysis) { + if (binding.scope !== analysis.module.scope) { + if (!('template' in analysis)) { + return false; + } if (binding.scope !== analysis.instance.scope) { return false; } - } else if (binding.scope !== analysis.module.scope) { - return false; } if (bindings.includes(binding)) {