From 0398a0dc6f0174775882c48179a5ae2d175b962a Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sun, 7 Jan 2024 09:14:14 -0800 Subject: [PATCH] format --- packages/svelte/src/compiler/phases/3-transform/client/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/svelte/src/compiler/phases/3-transform/client/utils.js b/packages/svelte/src/compiler/phases/3-transform/client/utils.js index a3450bdb26..cebd784f26 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/utils.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/utils.js @@ -556,6 +556,7 @@ export function can_hoist_declaration(binding, name) { !!binding && binding.kind === 'normal' && binding.scope.is_top_level && + binding.scope.has_parent() && // i.e. not when context="module" // For now we just allow primitives for simplicity. We could allow object expressions that are // not passed to functions or components as props and expressions as long as they do not // reference functions, constructors, non-hoistable variables, etc. @@ -568,6 +569,5 @@ export function can_hoist_declaration(binding, name) { // Avoid conflicts. It would be nice to rename the variable, but keeping it simple for now !binding.scope.declared_in_outer_scope(name) && !GlobalBindings.has(name) - && binding.scope.has_parent() // i.e. not when context="module" ); }