exitScope() — react Function Reference
Architecture documentation for the exitScope() function in PropagateScopeDependenciesHIR.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD fa34629f_c89e_a9bf_4c20_ec6a2b54a55c["exitScope()"] 1be3b542_2ecf_364c_adef_6e5675b7385e["DependencyCollectionContext"] fa34629f_c89e_a9bf_4c20_ec6a2b54a55c -->|defined in| 1be3b542_2ecf_364c_adef_6e5675b7385e 5b709ffb_65e9_2125_d608_a351c667cd6c["collectDependencies()"] 5b709ffb_65e9_2125_d608_a351c667cd6c -->|calls| fa34629f_c89e_a9bf_4c20_ec6a2b54a55c f523a4df_e5a4_d8d8_dbd0_ef75659ea0a5["inferDependencies()"] f523a4df_e5a4_d8d8_dbd0_ef75659ea0a5 -->|calls| fa34629f_c89e_a9bf_4c20_ec6a2b54a55c 041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"] fa34629f_c89e_a9bf_4c20_ec6a2b54a55c -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e 6a49e893_9e21_81a7_6317_29730acf93c2["pop()"] fa34629f_c89e_a9bf_4c20_ec6a2b54a55c -->|calls| 6a49e893_9e21_81a7_6317_29730acf93c2 358cdfdf_e03f_e4de_133c_5b70e0a98d45["push()"] fa34629f_c89e_a9bf_4c20_ec6a2b54a55c -->|calls| 358cdfdf_e03f_e4de_133c_5b70e0a98d45 style fa34629f_c89e_a9bf_4c20_ec6a2b54a55c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts lines 426–453
exitScope(scope: ReactiveScope, pruned: boolean): void {
// Save dependencies we collected from the exiting scope
const scopedDependencies = this.#dependencies.value;
CompilerError.invariant(scopedDependencies != null, {
reason: '[PropagateScopeDeps]: Unexpected scope mismatch',
loc: scope.loc,
});
// Restore context of previous scope
this.#scopes = this.#scopes.pop();
this.#dependencies = this.#dependencies.pop();
/*
* Collect dependencies we recorded for the exiting scope and propagate
* them upward using the same rules as normal dependency collection.
* Child scopes may have dependencies on values created within the outer
* scope, which necessarily cannot be dependencies of the outer scope.
*/
for (const dep of scopedDependencies) {
if (this.#checkValidDependency(dep)) {
this.#dependencies.value?.push(dep);
}
}
if (!pruned) {
this.deps.set(scope, scopedDependencies);
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does exitScope() do?
exitScope() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts.
Where is exitScope() defined?
exitScope() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts at line 426.
What does exitScope() call?
exitScope() calls 3 function(s): invariant, pop, push.
What calls exitScope()?
exitScope() is called by 2 function(s): collectDependencies, inferDependencies.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free