Home / Function/ optimizePropsMethodCalls() — react Function Reference

optimizePropsMethodCalls() — react Function Reference

Architecture documentation for the optimizePropsMethodCalls() function in OptimizePropsMethodCalls.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7fa40de0_6c03_ccf5_ce80_c1bfabcc2181["optimizePropsMethodCalls()"]
  8eda52b7_ff03_211a_9817_be340ccb9c33["OptimizePropsMethodCalls.ts"]
  7fa40de0_6c03_ccf5_ce80_c1bfabcc2181 -->|defined in| 8eda52b7_ff03_211a_9817_be340ccb9c33
  c3bc3875_256f_8f5e_7800_2f9c5bae65eb["runWithEnvironment()"]
  c3bc3875_256f_8f5e_7800_2f9c5bae65eb -->|calls| 7fa40de0_6c03_ccf5_ce80_c1bfabcc2181
  style 7fa40de0_6c03_ccf5_ce80_c1bfabcc2181 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/OptimizePropsMethodCalls.ts lines 35–52

export function optimizePropsMethodCalls(fn: HIRFunction): void {
  for (const [, block] of fn.body.blocks) {
    for (let i = 0; i < block.instructions.length; i++) {
      const instr = block.instructions[i]!;
      if (
        instr.value.kind === 'MethodCall' &&
        isPropsType(instr.value.receiver.identifier)
      ) {
        instr.value = {
          kind: 'CallExpression',
          callee: instr.value.property,
          args: instr.value.args,
          loc: instr.value.loc,
        };
      }
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does optimizePropsMethodCalls() do?
optimizePropsMethodCalls() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/OptimizePropsMethodCalls.ts.
Where is optimizePropsMethodCalls() defined?
optimizePropsMethodCalls() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/OptimizePropsMethodCalls.ts at line 35.
What calls optimizePropsMethodCalls()?
optimizePropsMethodCalls() is called by 1 function(s): runWithEnvironment.

Analyze Your Own Codebase

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

Try Supermodel Free