Home / Function/ captureScopes() — react Function Reference

captureScopes() — react Function Reference

Architecture documentation for the captureScopes() function in BuildHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  b762aa76_48ec_9fd1_85ca_e15408824cf5["captureScopes()"]
  e04c04d6_37a7_1dc3_7fae_7d07660d0af9["BuildHIR.ts"]
  b762aa76_48ec_9fd1_85ca_e15408824cf5 -->|defined in| e04c04d6_37a7_1dc3_7fae_7d07660d0af9
  de018292_621c_1061_1e34_80ea74ce2c88["gatherCapturedContext()"]
  de018292_621c_1061_1e34_80ea74ce2c88 -->|calls| b762aa76_48ec_9fd1_85ca_e15408824cf5
  style b762aa76_48ec_9fd1_85ca_e15408824cf5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts lines 4222–4234

function captureScopes({from, to}: {from: Scope; to: Scope}): Set<Scope> {
  let scopes: Set<Scope> = new Set();
  while (from) {
    scopes.add(from);

    if (from === to) {
      break;
    }

    from = from.parent;
  }
  return scopes;
}

Subdomains

Frequently Asked Questions

What does captureScopes() do?
captureScopes() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts.
Where is captureScopes() defined?
captureScopes() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts at line 4222.
What calls captureScopes()?
captureScopes() is called by 1 function(s): gatherCapturedContext.

Analyze Your Own Codebase

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

Try Supermodel Free