Home / Function/ apply() — react Function Reference

apply() — react Function Reference

Architecture documentation for the apply() function in InferTypes.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  257b9810_205d_8a64_1735_4cb469bb9ada["apply()"]
  35147ed6_ce97_e85f_570c_faf2d25f42f4["InferTypes.ts"]
  257b9810_205d_8a64_1735_4cb469bb9ada -->|defined in| 35147ed6_ce97_e85f_570c_faf2d25f42f4
  fafa4e35_d1bd_5163_9aea_72cb4d1742f3["inferTypes()"]
  fafa4e35_d1bd_5163_9aea_72cb4d1742f3 -->|calls| 257b9810_205d_8a64_1735_4cb469bb9ada
  f0603215_bdb0_88a0_8649_8c18b423f04f["get()"]
  257b9810_205d_8a64_1735_4cb469bb9ada -->|calls| f0603215_bdb0_88a0_8649_8c18b423f04f
  10043bf1_f7ee_9ed9_307a_fe3edfd02b09["eachInstructionLValue()"]
  257b9810_205d_8a64_1735_4cb469bb9ada -->|calls| 10043bf1_f7ee_9ed9_307a_fe3edfd02b09
  ccace1c3_85b7_a05e_c2a5_7eff8b3422ed["eachInstructionOperand()"]
  257b9810_205d_8a64_1735_4cb469bb9ada -->|calls| ccace1c3_85b7_a05e_c2a5_7eff8b3422ed
  style 257b9810_205d_8a64_1735_4cb469bb9ada fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/TypeInference/InferTypes.ts lines 74–99

function apply(func: HIRFunction, unifier: Unifier): void {
  for (const [_, block] of func.body.blocks) {
    for (const phi of block.phis) {
      phi.place.identifier.type = unifier.get(phi.place.identifier.type);
    }
    for (const instr of block.instructions) {
      for (const operand of eachInstructionLValue(instr)) {
        operand.identifier.type = unifier.get(operand.identifier.type);
      }
      for (const place of eachInstructionOperand(instr)) {
        place.identifier.type = unifier.get(place.identifier.type);
      }
      const {lvalue, value} = instr;
      lvalue.identifier.type = unifier.get(lvalue.identifier.type);

      if (
        value.kind === 'FunctionExpression' ||
        value.kind === 'ObjectMethod'
      ) {
        apply(value.loweredFunc.func, unifier);
      }
    }
  }
  const returns = func.returns.identifier;
  returns.type = unifier.get(returns.type);
}

Subdomains

Called By

Frequently Asked Questions

What does apply() do?
apply() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/TypeInference/InferTypes.ts.
Where is apply() defined?
apply() is defined in compiler/packages/babel-plugin-react-compiler/src/TypeInference/InferTypes.ts at line 74.
What does apply() call?
apply() calls 3 function(s): eachInstructionLValue, eachInstructionOperand, get.
What calls apply()?
apply() is called by 1 function(s): inferTypes.

Analyze Your Own Codebase

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

Try Supermodel Free