visitScope() — react Function Reference
Architecture documentation for the visitScope() function in PromoteUsedTemporaries.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 5e066f27_b301_d78c_0fde_a2fbb735acd8["visitScope()"] 0978ed10_d7af_9dac_ac08_cbaa51b0ff27["PromoteTemporaries"] 5e066f27_b301_d78c_0fde_a2fbb735acd8 -->|defined in| 0978ed10_d7af_9dac_ac08_cbaa51b0ff27 2eebfc2b_b1f6_9f25_ad32_78be0b56f06b["traverseScope()"] 5e066f27_b301_d78c_0fde_a2fbb735acd8 -->|calls| 2eebfc2b_b1f6_9f25_ad32_78be0b56f06b 81fadb8d_22f1_6208_bbd3_8af4016beda9["promoteIdentifier()"] 5e066f27_b301_d78c_0fde_a2fbb735acd8 -->|calls| 81fadb8d_22f1_6208_bbd3_8af4016beda9 4acb57df_5348_9aab_9691_41cf35127db4["visitScope()"] 5e066f27_b301_d78c_0fde_a2fbb735acd8 -->|calls| 4acb57df_5348_9aab_9691_41cf35127db4 style 5e066f27_b301_d78c_0fde_a2fbb735acd8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PromoteUsedTemporaries.ts lines 34–54
override visitScope(scopeBlock: ReactiveScopeBlock, state: State): void {
for (const dep of scopeBlock.scope.dependencies) {
const {identifier} = dep;
if (identifier.name == null) {
promoteIdentifier(identifier, state);
}
}
/*
* This is technically optional. We could prune ReactiveScopes
* whose outputs are not used in another computation or return
* value.
* Many of our current test fixtures do not return a value, so
* it is better for now to promote (and memoize) every output.
*/
for (const [, declaration] of scopeBlock.scope.declarations) {
if (declaration.identifier.name == null) {
promoteIdentifier(declaration.identifier, state);
}
}
this.traverseScope(scopeBlock, state);
}
Domain
Subdomains
Defined In
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/PromoteUsedTemporaries.ts.
Where is visitScope() defined?
visitScope() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PromoteUsedTemporaries.ts at line 34.
What does visitScope() call?
visitScope() calls 3 function(s): promoteIdentifier, traverseScope, visitScope.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free