From 682f4a651351d4c0c492be1806bfb119b6bb76a7 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Tue, 19 Mar 2024 19:25:40 +0100 Subject: [PATCH] fix: adjust scope parent for named slots (#10843) fixes #10802 --- .changeset/mighty-cooks-scream.md | 5 +++++ packages/svelte/src/compiler/phases/scope.js | 6 +++--- .../samples/component-slot-let-scope-4/Nested.svelte | 1 + .../component-slot-let-scope-4/Nested2.svelte | 9 +++++++++ .../samples/component-slot-let-scope-4/_config.js | 7 +++++++ .../samples/component-slot-let-scope-4/main.svelte | 12 ++++++++++++ 6 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .changeset/mighty-cooks-scream.md create mode 100644 packages/svelte/tests/runtime-legacy/samples/component-slot-let-scope-4/Nested.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/component-slot-let-scope-4/Nested2.svelte create mode 100644 packages/svelte/tests/runtime-legacy/samples/component-slot-let-scope-4/_config.js create mode 100644 packages/svelte/tests/runtime-legacy/samples/component-slot-let-scope-4/main.svelte diff --git a/.changeset/mighty-cooks-scream.md b/.changeset/mighty-cooks-scream.md new file mode 100644 index 0000000000..3d3e662fce --- /dev/null +++ b/.changeset/mighty-cooks-scream.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: adjust scope parent for named slots diff --git a/packages/svelte/src/compiler/phases/scope.js b/packages/svelte/src/compiler/phases/scope.js index cecd52bda8..9b0d3e7dcb 100644 --- a/packages/svelte/src/compiler/phases/scope.js +++ b/packages/svelte/src/compiler/phases/scope.js @@ -400,9 +400,9 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) { (attribute) => attribute.type === 'Attribute' && attribute.name === 'slot' ) ) { - //