can_hoist_snippet() — svelte Function Reference
Architecture documentation for the can_hoist_snippet() function in SnippetBlock.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 4fe2860f_6c10_b43a_a4dd_aec81cdcaaa2["can_hoist_snippet()"] e0442a00_296c_5b68_2228_3e947a4a5278["SnippetBlock.js"] 4fe2860f_6c10_b43a_a4dd_aec81cdcaaa2 -->|defined in| e0442a00_296c_5b68_2228_3e947a4a5278 170735b0_d19f_e8fe_cdc9_07ad2d5b7b3a["SnippetBlock()"] 170735b0_d19f_e8fe_cdc9_07ad2d5b7b3a -->|calls| 4fe2860f_6c10_b43a_a4dd_aec81cdcaaa2 style 4fe2860f_6c10_b43a_a4dd_aec81cdcaaa2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js lines 81–113
function can_hoist_snippet(scope, scopes, visited = new Set()) {
for (const [reference] of scope.references) {
const binding = scope.get(reference);
if (!binding) continue;
if (binding.blocker) {
return false;
}
if (binding.scope.function_depth === 0) {
continue;
}
// ignore bindings declared inside the snippet (e.g. the snippet's own parameters)
if (binding.scope.function_depth >= scope.function_depth) {
continue;
}
if (binding.initial?.type === 'SnippetBlock') {
if (visited.has(binding)) continue;
visited.add(binding);
const snippet_scope = /** @type {Scope} */ (scopes.get(binding.initial));
if (can_hoist_snippet(snippet_scope, scopes, visited)) {
continue;
}
}
return false;
}
return true;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does can_hoist_snippet() do?
can_hoist_snippet() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js.
Where is can_hoist_snippet() defined?
can_hoist_snippet() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js at line 81.
What calls can_hoist_snippet()?
can_hoist_snippet() is called by 1 function(s): SnippetBlock.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free