From ae7e5bbe3fb98b2b20824b1e6200c91f70c7d757 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 19 May 2025 11:37:23 -0400 Subject: [PATCH] fix --- .../src/compiler/phases/2-analyze/visitors/shared/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js b/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js index 10468595a4..d7b682da08 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js +++ b/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js @@ -57,7 +57,11 @@ export function validate_assignment(node, argument, context) { ) { const grandparent = get_parent(context.path, i - 1); - if (grandparent.type === 'MethodDefinition' && grandparent.kind === 'constructor') { + if ( + grandparent.type === 'MethodDefinition' && + grandparent.kind === 'constructor' && + /** @type {number} */ (node.start) < /** @type {number} */ (field.node.start) + ) { e.state_field_invalid_assignment(node); }