Home / Function/ getOverlappingReactiveScopes() — react Function Reference

getOverlappingReactiveScopes() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09["getOverlappingReactiveScopes()"]
  78244170_3d42_f86a_ea59_bce3e065fcfd["MergeOverlappingReactiveScopesHIR.ts"]
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 -->|defined in| 78244170_3d42_f86a_ea59_bce3e065fcfd
  ee1add24_e8b1_776d_87ba_d88fe78f7873["mergeOverlappingReactiveScopesHIR()"]
  ee1add24_e8b1_776d_87ba_d88fe78f7873 -->|calls| 764ec9fb_0ee9_a9ca_abc4_d7c652d01a09
  8fe866b3_2a9c_9e4d_fd10_7ac8435fc8db["visitInstructionId()"]
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 -->|calls| 8fe866b3_2a9c_9e4d_fd10_7ac8435fc8db
  ccace1c3_85b7_a05e_c2a5_7eff8b3422ed["eachInstructionOperand()"]
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 -->|calls| ccace1c3_85b7_a05e_c2a5_7eff8b3422ed
  a5b9529f_84bd_279c_4f87_657080b7385f["visitPlace()"]
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 -->|calls| a5b9529f_84bd_279c_4f87_657080b7385f
  10043bf1_f7ee_9ed9_307a_fe3edfd02b09["eachInstructionLValue()"]
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 -->|calls| 10043bf1_f7ee_9ed9_307a_fe3edfd02b09
  41232a25_deb6_6e83_05a8_ae9f961656f7["eachTerminalOperand()"]
  764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 -->|calls| 41232a25_deb6_6e83_05a8_ae9f961656f7
  style 764ec9fb_0ee9_a9ca_abc4_d7c652d01a09 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/MergeOverlappingReactiveScopesHIR.ts lines 280–313

function getOverlappingReactiveScopes(
  fn: HIRFunction,
  context: ScopeInfo,
): DisjointSet<ReactiveScope> {
  const state: TraversalState = {
    joined: new DisjointSet<ReactiveScope>(),
    activeScopes: [],
  };

  for (const [, block] of fn.body.blocks) {
    for (const instr of block.instructions) {
      visitInstructionId(instr.id, context, state);
      for (const place of eachInstructionOperand(instr)) {
        if (
          (instr.value.kind === 'FunctionExpression' ||
            instr.value.kind === 'ObjectMethod') &&
          place.identifier.type.kind === 'Primitive'
        ) {
          continue;
        }
        visitPlace(instr.id, place, state);
      }
      for (const place of eachInstructionLValue(instr)) {
        visitPlace(instr.id, place, state);
      }
    }
    visitInstructionId(block.terminal.id, context, state);
    for (const place of eachTerminalOperand(block.terminal)) {
      visitPlace(block.terminal.id, place, state);
    }
  }

  return state.joined;
}

Subdomains

Frequently Asked Questions

What does getOverlappingReactiveScopes() do?
getOverlappingReactiveScopes() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/MergeOverlappingReactiveScopesHIR.ts.
Where is getOverlappingReactiveScopes() defined?
getOverlappingReactiveScopes() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/MergeOverlappingReactiveScopesHIR.ts at line 280.
What does getOverlappingReactiveScopes() call?
getOverlappingReactiveScopes() calls 5 function(s): eachInstructionLValue, eachInstructionOperand, eachTerminalOperand, visitInstructionId, visitPlace.
What calls getOverlappingReactiveScopes()?
getOverlappingReactiveScopes() is called by 1 function(s): mergeOverlappingReactiveScopesHIR.

Analyze Your Own Codebase

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

Try Supermodel Free