fix: move labeled statements that need reordering after props insertion point (#13480)

pull/13485/head
Paolo Ricciuti 1 day ago committed by GitHub
parent 344808a719
commit 073ef17028
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: move labeled statements that need reordering after props insertion point

@ -237,7 +237,9 @@ export function migrate(source) {
dependencies.some(
(dep) =>
!ids.includes(dep) &&
/** @type {number} */ (dep.node.start) > /** @type {number} */ (node.start)
(dep.kind === 'prop' || dep.kind === 'bindable_prop'
? state.props_insertion_point
: /** @type {number} */ (dep.node.start)) > /** @type {number} */ (node.start)
)
) {
needs_reordering = true;

@ -0,0 +1,7 @@
<script>
export let readonly;
$: writable = !readonly;
export let optional = 'foo';
</script>
{readonly} {optional} {writable}

@ -0,0 +1,7 @@
<script>
/** @type {{readonly: any, optional?: string}} */
let { readonly, optional = 'foo' } = $props();
let writable = $derived(!readonly);
</script>
{readonly} {optional} {writable}
Loading…
Cancel
Save