Home / Function/ visitPlace() — react Function Reference

visitPlace() — react Function Reference

Architecture documentation for the visitPlace() function in MergeOverlappingReactiveScopesHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a5b9529f_84bd_279c_4f87_657080b7385f["visitPlace()"]
  78244170_3d42_f86a_ea59_bce3e065fcfd["MergeOverlappingReactiveScopesHIR.ts"]
  a5b9529f_84bd_279c_4f87_657080b7385f -->|defined in| 78244170_3d42_f86a_ea59_bce3e065fcfd
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09["getOverlappingReactiveScopes()"]
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 -->|calls| a5b9529f_84bd_279c_4f87_657080b7385f
  7107ba22_4065_0956_1ec3_286f637d0d22["getPlaceScope()"]
  a5b9529f_84bd_279c_4f87_657080b7385f -->|calls| 7107ba22_4065_0956_1ec3_286f637d0d22
  11746e9a_2fdf_98bb_bb3c_a63d8b200df2["isMutable()"]
  a5b9529f_84bd_279c_4f87_657080b7385f -->|calls| 11746e9a_2fdf_98bb_bb3c_a63d8b200df2
  style a5b9529f_84bd_279c_4f87_657080b7385f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/MergeOverlappingReactiveScopesHIR.ts lines 262–278

function visitPlace(
  id: InstructionId,
  place: Place,
  {activeScopes, joined}: TraversalState,
): void {
  /**
   * If an instruction mutates an outer scope, flatten all scopes from the top
   * of the stack to the mutated outer scope.
   */
  const placeScope = getPlaceScope(id, place);
  if (placeScope != null && isMutable({id}, place)) {
    const placeScopeIdx = activeScopes.indexOf(placeScope);
    if (placeScopeIdx !== -1 && placeScopeIdx !== activeScopes.length - 1) {
      joined.union([placeScope, ...activeScopes.slice(placeScopeIdx + 1)]);
    }
  }
}

Subdomains

Frequently Asked Questions

What does visitPlace() do?
visitPlace() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/MergeOverlappingReactiveScopesHIR.ts.
Where is visitPlace() defined?
visitPlace() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/MergeOverlappingReactiveScopesHIR.ts at line 262.
What does visitPlace() call?
visitPlace() calls 2 function(s): getPlaceScope, isMutable.
What calls visitPlace()?
visitPlace() is called by 1 function(s): getOverlappingReactiveScopes.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free