Home / Function/ getMaybeNonNullInInstruction() — react Function Reference

getMaybeNonNullInInstruction() — react Function Reference

Architecture documentation for the getMaybeNonNullInInstruction() function in CollectHoistablePropertyLoads.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  618d3d38_bcbf_713e_ce1a_d85056287498["getMaybeNonNullInInstruction()"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72["CollectHoistablePropertyLoads.ts"]
  618d3d38_bcbf_713e_ce1a_d85056287498 -->|defined in| 53e05ed1_ffb1_8db2_8573_ef5a3fb99c72
  2c85e7b5_d003_b439_dc7b_cb881996ea23["collectNonNullsInBlocks()"]
  2c85e7b5_d003_b439_dc7b_cb881996ea23 -->|calls| 618d3d38_bcbf_713e_ce1a_d85056287498
  afcd35a2_87ac_64f3_d39b_e78954698dc0["getOrCreateProperty()"]
  618d3d38_bcbf_713e_ce1a_d85056287498 -->|calls| afcd35a2_87ac_64f3_d39b_e78954698dc0
  style 618d3d38_bcbf_713e_ce1a_d85056287498 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts lines 325–342

function getMaybeNonNullInInstruction(
  instr: InstructionValue,
  context: CollectHoistablePropertyLoadsContext,
): PropertyPathNode | null {
  let path: ReactiveScopeDependency | null = null;
  if (instr.kind === 'PropertyLoad') {
    path = context.temporaries.get(instr.object.identifier.id) ?? {
      identifier: instr.object.identifier,
      reactive: instr.object.reactive,
      path: [],
    };
  } else if (instr.kind === 'Destructure') {
    path = context.temporaries.get(instr.value.identifier.id) ?? null;
  } else if (instr.kind === 'ComputedLoad') {
    path = context.temporaries.get(instr.object.identifier.id) ?? null;
  }
  return path != null ? context.registry.getOrCreateProperty(path) : null;
}

Subdomains

Frequently Asked Questions

What does getMaybeNonNullInInstruction() do?
getMaybeNonNullInInstruction() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts.
Where is getMaybeNonNullInInstruction() defined?
getMaybeNonNullInInstruction() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts at line 325.
What does getMaybeNonNullInInstruction() call?
getMaybeNonNullInInstruction() calls 1 function(s): getOrCreateProperty.
What calls getMaybeNonNullInInstruction()?
getMaybeNonNullInInstruction() is called by 1 function(s): collectNonNullsInBlocks.

Analyze Your Own Codebase

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

Try Supermodel Free