Skip to content

Commit f1bbe72

Browse files
committed
simplify
1 parent c6362c7 commit f1bbe72

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,9 @@ function can_hoist_snippet(node, scope, scopes, visited = new Set()) {
9090
continue;
9191
}
9292

93-
/** @type {Scope | null} */
94-
let current_scope = binding.scope;
95-
96-
while (current_scope !== null) {
97-
if (current_scope === scope) {
98-
continue ref_loop;
99-
}
100-
101-
current_scope = current_scope.parent;
93+
// ignore bindings declared inside the snippet (e.g. the snippet's own parameters)
94+
if (binding.scope.function_depth >= scope.function_depth) {
95+
continue;
10296
}
10397

10498
// Recursively check if another snippet can be hoisted

0 commit comments

Comments
 (0)