Repository: sveltejs/svelte
File: packages/svelte/src/compiler/phases/2-analyze/index.js (JavaScript)

Code before:
							w.store_rune_conflict(node, store_name);
						}
					}
				}
			}

			if (module.ast) {
				for (const { node, path } of references) {
					// if the reference is inside module, error. this is a bit hacky but it works
					if (
						/** @type {number} */ (node.start) > /** @type {number} */ (module.ast.start) &&
						/** @type {number} */ (node.end) < /** @type {number} */ (module.ast.end) &&
						// const state = $state(0) is valid
						get_rune(/** @type {Node} */ (path.at(-1)), module.scope) === null
					) {
						e.store_invalid_subscription(node);
					}
				}
			}

			// if we are creating a synthetic binding for a let declaration we should also declare
			// the declaration as state in case it's reassigned
			if (
				declaration !== null &&
				declaration.kind === 'normal' &&
				declaration.declaration_kind === 'let'
			)
				declaration.kind = 'state';

			const binding = instance.scope.declare(b.id(name), 'store_sub', 'synthetic');
			binding.references = references;
			instance.scope.references.set(name, references);
			module.scope.references.delete(name);
		}
	}

	const component_name = get_component_name(options.filename);

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

	if (runes && root.module) {
		const context = root.module.attributes.find((attribute) => attribute.name === 'context');
		if (context) {
			w.script_context_deprecated(context);
		}
	}

	// TODO remove all the ?? stuff, we don't need it now that we're validating the config
	/** @type {ComponentAnalysis} */
	const analysis = {
		name: module.scope.generate(options.name ?? component_name),

Review comment (suggestion):
The comment says "...in case it's reassigned", but I don't see that in the if condition - is that on purpose or should we add it?
```suggestion
				declaration.declaration_kind === 'let' &&
				declaration.reassigned
```

Code after:
							w.store_rune_conflict(node, store_name);
						}
					}
				}
			}

			if (module.ast) {
				for (const { node, path } of references) {
					// if the reference is inside module, error. this is a bit hacky but it works
					if (
						/** @type {number} */ (node.start) > /** @type {number} */ (module.ast.start) &&
						/** @type {number} */ (node.end) < /** @type {number} */ (module.ast.end) &&
						// const state = $state(0) is valid
						get_rune(/** @type {Node} */ (path.at(-1)), module.scope) === null
					) {
						e.store_invalid_subscription(node);
					}
				}
			}

			// if we are creating a synthetic binding for a let declaration we should also declare
			// the declaration as state in case it's reassigned
			if (
				declaration !== null &&
				declaration.kind === 'normal' &&
				declaration.declaration_kind === 'let' &&
				declaration.reassigned
			) {
				declaration.kind = 'state';
			}

			const binding = instance.scope.declare(b.id(name), 'store_sub', 'synthetic');
			binding.references = references;
			instance.scope.references.set(name, references);
			module.scope.references.delete(name);
		}
	}

	const component_name = get_component_name(options.filename);

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

	if (runes && root.module) {
		const context = root.module.attributes.find((attribute) => attribute.name === 'context');
		if (context) {
			w.script_context_deprecated(context);
		}
	}

	// TODO remove all the ?? stuff, we don't need it now that we're validating the config
	/** @type {ComponentAnalysis} */