From 8dea7d1c5275dad78768b3e8eb71285b4849b7a5 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Sat, 31 Jan 2026 21:26:53 +0100 Subject: [PATCH] fix: avoid double loop --- packages/svelte/src/compiler/phases/2-analyze/index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/svelte/src/compiler/phases/2-analyze/index.js b/packages/svelte/src/compiler/phases/2-analyze/index.js index fdd7b9d6e1..b01858690e 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/index.js +++ b/packages/svelte/src/compiler/phases/2-analyze/index.js @@ -764,16 +764,12 @@ export function analyze_component(root, source, options) { w.non_reactive_update(binding.node, name); continue outer; } + } else if (binding.kind === 'bindable_prop' && !binding.updated) { + // this check only applies to instance but we check here to avoid a second loop + w.bindable_prop_not_mutated(binding.node, name); } } } - - // warn on bindable props that are never mutated or reassigned - for (const [name, binding] of instance.scope.declarations) { - if (binding.kind === 'bindable_prop' && !binding.updated) { - w.bindable_prop_not_mutated(binding.node, name); - } - } } else { instance.scope.declare(b.id('$$props'), 'rest_prop', 'synthetic'); instance.scope.declare(b.id('$$restProps'), 'rest_prop', 'synthetic');