Home / Function/ isLoadContextMutable() — react Function Reference

isLoadContextMutable() — react Function Reference

Architecture documentation for the isLoadContextMutable() function in PropagateScopeDependenciesHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9383934c_0b46_008d_a075_fa264ddb243d["isLoadContextMutable()"]
  76832af2_c0a7_f31c_e448_af5664da4b88["PropagateScopeDependenciesHIR.ts"]
  9383934c_0b46_008d_a075_fa264ddb243d -->|defined in| 76832af2_c0a7_f31c_e448_af5664da4b88
  bd383390_a354_8863_d439_cafcd9e7a730["collectTemporariesSidemapImpl()"]
  bd383390_a354_8863_d439_cafcd9e7a730 -->|calls| 9383934c_0b46_008d_a075_fa264ddb243d
  style 9383934c_0b46_008d_a075_fa264ddb243d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts lines 245–264

function isLoadContextMutable(
  instrValue: InstructionValue,
  id: InstructionId,
): instrValue is LoadContext {
  if (instrValue.kind === 'LoadContext') {
    /**
     * Not all context variables currently have scopes due to limitations of
     * mutability analysis for function expressions.
     *
     * Currently, many function expressions references are inferred to be
     * 'Read' | 'Freeze' effects which don't replay mutable effects of captured
     * context.
     */
    return (
      instrValue.place.identifier.scope != null &&
      id >= instrValue.place.identifier.scope.range.end
    );
  }
  return false;
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free