Home / Function/ getScopes() — react Function Reference

getScopes() — react Function Reference

Architecture documentation for the getScopes() function in AssertValidBlockNesting.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  ad41542d_7277_a7c4_02f9_ea27be6345d4["getScopes()"]
  5dff208f_71b7_72c1_b78a_03be9b621b2a["AssertValidBlockNesting.ts"]
  ad41542d_7277_a7c4_02f9_ea27be6345d4 -->|defined in| 5dff208f_71b7_72c1_b78a_03be9b621b2a
  8df1c728_cbcd_34ab_bd90_969f45256d13["assertValidBlockNesting()"]
  8df1c728_cbcd_34ab_bd90_969f45256d13 -->|calls| ad41542d_7277_a7c4_02f9_ea27be6345d4
  67879f67_c0fc_dc2d_b736_b9213153bc4a["buildReactiveScopeTerminalsHIR()"]
  67879f67_c0fc_dc2d_b736_b9213153bc4a -->|calls| ad41542d_7277_a7c4_02f9_ea27be6345d4
  10043bf1_f7ee_9ed9_307a_fe3edfd02b09["eachInstructionLValue()"]
  ad41542d_7277_a7c4_02f9_ea27be6345d4 -->|calls| 10043bf1_f7ee_9ed9_307a_fe3edfd02b09
  ccace1c3_85b7_a05e_c2a5_7eff8b3422ed["eachInstructionOperand()"]
  ad41542d_7277_a7c4_02f9_ea27be6345d4 -->|calls| ccace1c3_85b7_a05e_c2a5_7eff8b3422ed
  41232a25_deb6_6e83_05a8_ae9f961656f7["eachTerminalOperand()"]
  ad41542d_7277_a7c4_02f9_ea27be6345d4 -->|calls| 41232a25_deb6_6e83_05a8_ae9f961656f7
  style ad41542d_7277_a7c4_02f9_ea27be6345d4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/AssertValidBlockNesting.ts lines 59–87

export function getScopes(fn: HIRFunction): Set<ReactiveScope> {
  const scopes: Set<ReactiveScope> = new Set();
  function visitPlace(place: Place): void {
    const scope = place.identifier.scope;
    if (scope != null) {
      if (scope.range.start !== scope.range.end) {
        scopes.add(scope);
      }
    }
  }

  for (const [, block] of fn.body.blocks) {
    for (const instr of block.instructions) {
      for (const operand of eachInstructionLValue(instr)) {
        visitPlace(operand);
      }

      for (const operand of eachInstructionOperand(instr)) {
        visitPlace(operand);
      }
    }

    for (const operand of eachTerminalOperand(block.terminal)) {
      visitPlace(operand);
    }
  }

  return scopes;
}

Subdomains

Frequently Asked Questions

What does getScopes() do?
getScopes() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/AssertValidBlockNesting.ts.
Where is getScopes() defined?
getScopes() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/AssertValidBlockNesting.ts at line 59.
What does getScopes() call?
getScopes() calls 3 function(s): eachInstructionLValue, eachInstructionOperand, eachTerminalOperand.
What calls getScopes()?
getScopes() is called by 2 function(s): assertValidBlockNesting, buildReactiveScopeTerminalsHIR.

Analyze Your Own Codebase

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

Try Supermodel Free