Home / Function/ assertTerminalPredsExist() — react Function Reference

assertTerminalPredsExist() — react Function Reference

Architecture documentation for the assertTerminalPredsExist() function in AssertTerminalBlocksExist.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  4646d89c_9f6a_8a52_ab75_6a55cfb3ff56["assertTerminalPredsExist()"]
  572aada9_286c_f6c1_f21b_7883e8a8a120["AssertTerminalBlocksExist.ts"]
  4646d89c_9f6a_8a52_ab75_6a55cfb3ff56 -->|defined in| 572aada9_286c_f6c1_f21b_7883e8a8a120
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  4646d89c_9f6a_8a52_ab75_6a55cfb3ff56 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  d737cb4c_53f4_75b4_2d58_268e2f73fde4["eachTerminalSuccessor()"]
  4646d89c_9f6a_8a52_ab75_6a55cfb3ff56 -->|calls| d737cb4c_53f4_75b4_2d58_268e2f73fde4
  style 4646d89c_9f6a_8a52_ab75_6a55cfb3ff56 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/AssertTerminalBlocksExist.ts lines 28–47

export function assertTerminalPredsExist(fn: HIRFunction): void {
  for (const [, block] of fn.body.blocks) {
    for (const pred of block.preds) {
      const predBlock = fn.body.blocks.get(pred);
      CompilerError.invariant(predBlock != null, {
        reason: 'Expected predecessor block to exist',
        description: `Block ${block.id} references non-existent ${pred}`,
        loc: GeneratedSource,
      });
      CompilerError.invariant(
        [...eachTerminalSuccessor(predBlock.terminal)].includes(block.id),
        {
          reason: 'Terminal successor does not reference correct predecessor',
          description: `Block bb${block.id} has bb${predBlock.id} as a predecessor, but bb${predBlock.id}'s successors do not include bb${block.id}`,
          loc: GeneratedSource,
        },
      );
    }
  }
}

Subdomains

Frequently Asked Questions

What does assertTerminalPredsExist() do?
assertTerminalPredsExist() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/AssertTerminalBlocksExist.ts.
Where is assertTerminalPredsExist() defined?
assertTerminalPredsExist() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/AssertTerminalBlocksExist.ts at line 28.
What does assertTerminalPredsExist() call?
assertTerminalPredsExist() calls 2 function(s): eachTerminalSuccessor, invariant.

Analyze Your Own Codebase

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

Try Supermodel Free