Home / Function/ computePostDominatorTree() — react Function Reference

computePostDominatorTree() — react Function Reference

Architecture documentation for the computePostDominatorTree() function in Dominator.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7703f432_520f_80d2_69d8_201d9cb9eb55["computePostDominatorTree()"]
  b02a9daf_aca4_b66a_9b9b_0b739a8ca4aa["Dominator.ts"]
  7703f432_520f_80d2_69d8_201d9cb9eb55 -->|defined in| b02a9daf_aca4_b66a_9b9b_0b739a8ca4aa
  1c6dc7ec_72e1_b907_d23f_94b6a80c2a2d["createControlDominators()"]
  1c6dc7ec_72e1_b907_d23f_94b6a80c2a2d -->|calls| 7703f432_520f_80d2_69d8_201d9cb9eb55
  1701b18d_6c73_7c36_a402_f71529487c3e["buildReverseGraph()"]
  7703f432_520f_80d2_69d8_201d9cb9eb55 -->|calls| 1701b18d_6c73_7c36_a402_f71529487c3e
  9817c1db_b7a8_e8dc_1ed4_f224e36002e9["computeImmediateDominators()"]
  7703f432_520f_80d2_69d8_201d9cb9eb55 -->|calls| 9817c1db_b7a8_e8dc_1ed4_f224e36002e9
  style 7703f432_520f_80d2_69d8_201d9cb9eb55 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/Dominator.ts lines 35–55

export function computePostDominatorTree(
  fn: HIRFunction,
  options: {includeThrowsAsExitNode: boolean},
): PostDominator<BlockId> {
  const graph = buildReverseGraph(fn, options.includeThrowsAsExitNode);
  const nodes = computeImmediateDominators(graph);

  /*
   * When options.includeThrowsAsExitNode is false, nodes that flow into a throws
   * terminal and don't reach the exit node won't be in the node map. Add them
   * with themselves as dominator to reflect that they don't flow into the exit.
   */
  if (!options.includeThrowsAsExitNode) {
    for (const [id] of fn.body.blocks) {
      if (!nodes.has(id)) {
        nodes.set(id, id);
      }
    }
  }
  return new PostDominator(graph.entry, nodes);
}

Subdomains

Frequently Asked Questions

What does computePostDominatorTree() do?
computePostDominatorTree() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/Dominator.ts.
Where is computePostDominatorTree() defined?
computePostDominatorTree() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/Dominator.ts at line 35.
What does computePostDominatorTree() call?
computePostDominatorTree() calls 2 function(s): buildReverseGraph, computeImmediateDominators.
What calls computePostDominatorTree()?
computePostDominatorTree() is called by 1 function(s): createControlDominators.

Analyze Your Own Codebase

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

Try Supermodel Free