visitScope() — react Function Reference
Architecture documentation for the visitScope() function in PruneHoistedContexts.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 362d4dbc_afba_225c_96b2_ea1c61130620["visitScope()"] d5fccea7_98aa_783b_f46b_c702031e387a["Visitor"] 362d4dbc_afba_225c_96b2_ea1c61130620 -->|defined in| d5fccea7_98aa_783b_f46b_c702031e387a 2eebfc2b_b1f6_9f25_ad32_78be0b56f06b["traverseScope()"] 362d4dbc_afba_225c_96b2_ea1c61130620 -->|calls| 2eebfc2b_b1f6_9f25_ad32_78be0b56f06b 4acb57df_5348_9aab_9691_41cf35127db4["visitScope()"] 362d4dbc_afba_225c_96b2_ea1c61130620 -->|calls| 4acb57df_5348_9aab_9691_41cf35127db4 1e630bb6_97fc_d2ab_389a_d5737426d78f["push()"] 362d4dbc_afba_225c_96b2_ea1c61130620 -->|calls| 1e630bb6_97fc_d2ab_389a_d5737426d78f 6a49e893_9e21_81a7_6317_29730acf93c2["pop()"] 362d4dbc_afba_225c_96b2_ea1c61130620 -->|calls| 6a49e893_9e21_81a7_6317_29730acf93c2 style 362d4dbc_afba_225c_96b2_ea1c61130620 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneHoistedContexts.ts lines 65–81
override visitScope(scope: ReactiveScopeBlock, state: VisitorState): void {
state.activeScopes = state.activeScopes.push(
new Set(scope.scope.declarations.keys()),
);
/**
* Add declared but not initialized / assigned variables. This may include
* function declarations that escape the memo block.
*/
for (const decl of scope.scope.declarations.values()) {
state.uninitialized.set(decl.identifier.id, {kind: 'unknown-kind'});
}
this.traverseScope(scope, state);
state.activeScopes.pop();
for (const decl of scope.scope.declarations.values()) {
state.uninitialized.delete(decl.identifier.id);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does visitScope() do?
visitScope() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneHoistedContexts.ts.
Where is visitScope() defined?
visitScope() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneHoistedContexts.ts at line 65.
What does visitScope() call?
visitScope() calls 4 function(s): pop, push, traverseScope, visitScope.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free