Home / Function/ pruneMaybeThrowsImpl() — react Function Reference

pruneMaybeThrowsImpl() — react Function Reference

Architecture documentation for the pruneMaybeThrowsImpl() function in PruneMaybeThrows.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  76aaa4bc_62ed_032d_e274_f5e5d6ced883["pruneMaybeThrowsImpl()"]
  7b84c51c_1c0f_cc0c_c3be_9da73dc183aa["PruneMaybeThrows.ts"]
  76aaa4bc_62ed_032d_e274_f5e5d6ced883 -->|defined in| 7b84c51c_1c0f_cc0c_c3be_9da73dc183aa
  82b1d221_48c8_7d34_669c_abce4ff71f21["pruneMaybeThrows()"]
  82b1d221_48c8_7d34_669c_abce4ff71f21 -->|calls| 76aaa4bc_62ed_032d_e274_f5e5d6ced883
  3b214fd4_9904_5348_72dd_2dfe3c19b967["instructionMayThrow()"]
  76aaa4bc_62ed_032d_e274_f5e5d6ced883 -->|calls| 3b214fd4_9904_5348_72dd_2dfe3c19b967
  style 76aaa4bc_62ed_032d_e274_f5e5d6ced883 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/PruneMaybeThrows.ts lines 77–94

function pruneMaybeThrowsImpl(fn: HIRFunction): Map<BlockId, BlockId> | null {
  const terminalMapping = new Map<BlockId, BlockId>();
  for (const [_, block] of fn.body.blocks) {
    const terminal = block.terminal;
    if (terminal.kind !== 'maybe-throw') {
      continue;
    }
    const canThrow = block.instructions.some(instr =>
      instructionMayThrow(instr),
    );
    if (!canThrow) {
      const source = terminalMapping.get(block.id) ?? block.id;
      terminalMapping.set(terminal.continuation, source);
      terminal.handler = null;
    }
  }
  return terminalMapping.size > 0 ? terminalMapping : null;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does pruneMaybeThrowsImpl() do?
pruneMaybeThrowsImpl() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/PruneMaybeThrows.ts.
Where is pruneMaybeThrowsImpl() defined?
pruneMaybeThrowsImpl() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/PruneMaybeThrows.ts at line 77.
What does pruneMaybeThrowsImpl() call?
pruneMaybeThrowsImpl() calls 1 function(s): instructionMayThrow.
What calls pruneMaybeThrowsImpl()?
pruneMaybeThrowsImpl() is called by 1 function(s): pruneMaybeThrows.

Analyze Your Own Codebase

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

Try Supermodel Free