Skip to content

Commit c2a830e

Browse files
committed
fix: avoid calling checks if we are in runes mode
1 parent 812d66c commit c2a830e

File tree

1 file changed

+8
-6
lines changed
  • packages/svelte/src/compiler/phases/2-analyze

1 file changed

+8
-6
lines changed

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,15 @@ export function analyze_component(root, source, options) {
355355

356356
// we push to the array because at this moment in time we can't be sure if we are in legacy
357357
// mode yet because we are still changing the module scope
358-
synthetic_stores_legacy_check.push((/** @type {boolean} */ runes) => {
358+
synthetic_stores_legacy_check.push(() => {
359359
// if we are creating a synthetic binding for a let declaration we should also declare
360-
// the declaration as state in case it's reassigned and we are not in runes mode
360+
// the declaration as state in case it's reassigned and we are not in runes mode (the function will
361+
// not be called if we are not in runes mode, that's why there's no !runes check here)
361362
if (
362363
declaration !== null &&
363364
declaration.kind === 'normal' &&
364365
declaration.declaration_kind === 'let' &&
365-
declaration.reassigned &&
366-
!runes
366+
declaration.reassigned
367367
) {
368368
declaration.kind = 'state';
369369
}
@@ -380,8 +380,10 @@ export function analyze_component(root, source, options) {
380380

381381
const runes = options.runes ?? Array.from(module.scope.references.keys()).some(is_rune);
382382

383-
for (let check of synthetic_stores_legacy_check) {
384-
check(runes);
383+
if (!runes) {
384+
for (let check of synthetic_stores_legacy_check) {
385+
check();
386+
}
385387
}
386388

387389
if (runes && root.module) {

0 commit comments

Comments
 (0)