Home / Function/ getDepth() — react Function Reference

getDepth() — react Function Reference

Architecture documentation for the getDepth() function in InstructionReordering.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  c7c1eb69_eed3_63a6_a393_058189e67642["getDepth()"]
  dc3f5251_a95c_3c77_5550_3882c13a37c9["InstructionReordering.ts"]
  c7c1eb69_eed3_63a6_a393_058189e67642 -->|defined in| dc3f5251_a95c_3c77_5550_3882c13a37c9
  7b9ee6ee_c43a_8594_2d2b_4347e2e623a4["print()"]
  7b9ee6ee_c43a_8594_2d2b_4347e2e623a4 -->|calls| c7c1eb69_eed3_63a6_a393_058189e67642
  2d212850_94bf_e0bb_e10d_403ccfc88d1d["emit()"]
  2d212850_94bf_e0bb_e10d_403ccfc88d1d -->|calls| c7c1eb69_eed3_63a6_a393_058189e67642
  style c7c1eb69_eed3_63a6_a393_058189e67642 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts lines 372–387

function getDepth(env: Environment, nodes: Nodes, id: IdentifierId): number {
  const node = nodes.get(id)!;
  if (node == null) {
    return 0;
  }
  if (node.depth != null) {
    return node.depth;
  }
  node.depth = 0; // in case of cycles
  let depth = node.reorderability === Reorderability.Reorderable ? 1 : 10;
  for (const dep of node.dependencies) {
    depth += getDepth(env, nodes, dep);
  }
  node.depth = depth;
  return depth;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getDepth() do?
getDepth() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts.
Where is getDepth() defined?
getDepth() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts at line 372.
What calls getDepth()?
getDepth() is called by 2 function(s): emit, print.

Analyze Your Own Codebase

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

Try Supermodel Free