calculate_blockers() — svelte Function Reference
Architecture documentation for the calculate_blockers() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD aced5321_4478_4f67_ba8c_e122713c1d9f["calculate_blockers()"] 4aa8a188_84d4_0274_ed83_cac0ab1d3572["index.js"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|defined in| 4aa8a188_84d4_0274_ed83_cac0ab1d3572 78a6ba9a_5003_f569_a638_76e4f1977809["analyze_component()"] 78a6ba9a_5003_f569_a638_76e4f1977809 -->|calls| aced5321_4478_4f67_ba8c_e122713c1d9f 784480d0_767d_ac40_b03e_ae8ddcc82684["Set()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| 784480d0_767d_ac40_b03e_ae8ddcc82684 f72c7999_3638_d4ad_b02b_f10540505c54["ImportDeclaration()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| f72c7999_3638_d4ad_b02b_f10540505c54 5c01291d_15ff_bab3_2463_d54766affbf6["Identifier()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| 5c01291d_15ff_bab3_2463_d54766affbf6 627dc2f8_4dbc_5bb1_8f54_cee503e17098["get()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| 627dc2f8_4dbc_5bb1_8f54_cee503e17098 d935f45f_6959_e32d_6e74_07f0885da3b7["unwrap_pattern()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| d935f45f_6959_e32d_6e74_07f0885da3b7 804afe56_25d1_9f41_dafe_adc75e952134["object()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| 804afe56_25d1_9f41_dafe_adc75e952134 d33c6b94_58e2_ebb4_1c33_58fa9af1535d["AssignmentExpression()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| d33c6b94_58e2_ebb4_1c33_58fa9af1535d 05215418_7b1e_a936_d190_16d901793aae["UpdateExpression()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| 05215418_7b1e_a936_d190_16d901793aae f847bd70_7e16_ed37_5fde_c34cd0ce1d43["CallExpression()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| f847bd70_7e16_ed37_5fde_c34cd0ce1d43 bed91719_d047_2256_e199_ee875d5f49b9["get_rune()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| bed91719_d047_2256_e199_ee875d5f49b9 58dd95ce_ec89_3632_c3c2_960c79eb5ec0["ArrowFunctionExpression()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| 58dd95ce_ec89_3632_c3c2_960c79eb5ec0 56f3948c_7ceb_ca49_e56d_8edd0d6e5ded["FunctionDeclaration()"] aced5321_4478_4f67_ba8c_e122713c1d9f -->|calls| 56f3948c_7ceb_ca49_e56d_8edd0d6e5ded style aced5321_4478_4f67_ba8c_e122713c1d9f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/index.js lines 947–1217
function calculate_blockers(instance, scopes, analysis) {
/**
* @param {ESTree.Node} expression
* @param {Scope} scope
* @param {Set<Binding>} touched
* @param {Set<ESTree.Node>} seen
*/
const touch = (expression, scope, touched, seen = new Set()) => {
if (seen.has(expression)) return;
seen.add(expression);
walk(
expression,
{ scope },
{
ImportDeclaration(node) {},
Identifier(node, context) {
const parent = /** @type {ESTree.Node} */ (context.path.at(-1));
if (is_reference(node, parent)) {
const binding = context.state.scope.get(node.name);
if (binding) {
touched.add(binding);
for (const assignment of binding.assignments) {
touch(assignment.value, assignment.scope, touched, seen);
}
}
}
}
}
);
};
/**
* @param {ESTree.Node} node
* @param {Set<ESTree.Node>} seen
* @param {Set<Binding>} reads
* @param {Set<Binding>} writes
*/
const trace_references = (node, reads, writes, seen = new Set()) => {
if (seen.has(node)) return;
seen.add(node);
/**
* @param {ESTree.Pattern} node
* @param {Scope} scope
*/
function update(node, scope) {
for (const pattern of unwrap_pattern(node)) {
const node = object(pattern);
if (!node) return;
const binding = scope.get(node.name);
if (!binding) return;
writes.add(binding);
}
}
walk(
node,
{ scope: instance.scope },
{
_(node, context) {
const scope = scopes.get(node);
if (scope) {
context.next({ scope });
} else {
context.next();
}
},
AssignmentExpression(node, context) {
update(node.left, context.state.scope);
},
UpdateExpression(node, context) {
update(
/** @type {ESTree.Identifier | ESTree.MemberExpression} */ (node.argument),
context.state.scope
);
},
CallExpression(node, context) {
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does calculate_blockers() do?
calculate_blockers() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/index.js.
Where is calculate_blockers() defined?
calculate_blockers() is defined in packages/svelte/src/compiler/phases/2-analyze/index.js at line 947.
What does calculate_blockers() call?
calculate_blockers() calls 15 function(s): ArrowFunctionExpression, AssignmentExpression, CallExpression, FunctionDeclaration, FunctionExpression, Identifier, ImportDeclaration, Set, and 7 more.
What calls calculate_blockers()?
calculate_blockers() is called by 1 function(s): analyze_component.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free