diff --git a/packages/svelte/src/compiler/phases/2-analyze/validation.js b/packages/svelte/src/compiler/phases/2-analyze/validation.js index 4e6dbb6239..34e86a6f29 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/validation.js +++ b/packages/svelte/src/compiler/phases/2-analyze/validation.js @@ -969,9 +969,7 @@ function validate_no_const_assignment(node, argument, scope, is_binding) { function validate_assignment(node, argument, state) { validate_no_const_assignment(node, argument, state.scope, false); - if (!state.analysis.runes) return; - - if (argument.type === 'Identifier') { + if (state.analysis.runes && argument.type === 'Identifier') { const binding = state.scope.get(argument.name); if (binding?.kind === 'derived') { error(node, 'invalid-derived-assignment'); @@ -982,17 +980,17 @@ function validate_assignment(node, argument, state) { } } - let obj = /** @type {import('estree').Expression | import('estree').Super} */ (argument); + let object = /** @type {import('estree').Expression | import('estree').Super} */ (argument); /** @type {import('estree').Expression | import('estree').PrivateIdentifier | null} */ let property = null; - while (obj.type === 'MemberExpression') { - property = obj.property; - obj = obj.object; + while (object.type === 'MemberExpression') { + property = object.property; + object = object.object; } - if (obj.type === 'ThisExpression' && property?.type === 'PrivateIdentifier') { + if (object.type === 'ThisExpression' && property?.type === 'PrivateIdentifier') { if (state.private_derived_state.includes(property.name)) { error(node, 'invalid-derived-assignment'); } diff --git a/packages/svelte/src/compiler/phases/3-transform/client/transform-client.js b/packages/svelte/src/compiler/phases/3-transform/client/transform-client.js index eaef6aa549..ae72d5e070 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/transform-client.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/transform-client.js @@ -488,10 +488,7 @@ export function client_component(source, analysis, options) { /** @type {import('estree').Property[]} */ const props_str = []; - for (const [name, binding] of analysis.instance.scope.declarations) { - if ((binding.kind !== 'prop' && binding.kind !== 'bindable_prop') || name.startsWith('$$')) - continue; - + for (const [name, binding] of properties) { const key = binding.prop_alias ?? name; const prop_def = typeof ce === 'boolean' ? {} : ce.props?.[key] || {}; if (