Home / Function/ rewriteBlock() — react Function Reference

rewriteBlock() — react Function Reference

Architecture documentation for the rewriteBlock() function in InlineImmediatelyInvokedFunctionExpressions.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5d6a6c3a_57cd_ff77_97d0_b01d97af89ad["rewriteBlock()"]
  e96debd1_c62e_fa86_d259_20617c0dc175["InlineImmediatelyInvokedFunctionExpressions.ts"]
  5d6a6c3a_57cd_ff77_97d0_b01d97af89ad -->|defined in| e96debd1_c62e_fa86_d259_20617c0dc175
  d77babff_42d3_5fdf_4059_c0b9e7cfaeb0["inlineImmediatelyInvokedFunctionExpressions()"]
  d77babff_42d3_5fdf_4059_c0b9e7cfaeb0 -->|calls| 5d6a6c3a_57cd_ff77_97d0_b01d97af89ad
  53244187_914c_cc90_5880_7bfc1fc9c0bb["push()"]
  5d6a6c3a_57cd_ff77_97d0_b01d97af89ad -->|calls| 53244187_914c_cc90_5880_7bfc1fc9c0bb
  49446ae1_b830_9411_8258_1139d21b314b["createTemporaryPlace()"]
  5d6a6c3a_57cd_ff77_97d0_b01d97af89ad -->|calls| 49446ae1_b830_9411_8258_1139d21b314b
  style 5d6a6c3a_57cd_ff77_97d0_b01d97af89ad fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts lines 284–314

function rewriteBlock(
  env: Environment,
  block: BasicBlock,
  returnTarget: BlockId,
  returnValue: Place,
): void {
  const {terminal} = block;
  if (terminal.kind !== 'return') {
    return;
  }
  block.instructions.push({
    id: makeInstructionId(0),
    loc: terminal.loc,
    lvalue: createTemporaryPlace(env, terminal.loc),
    value: {
      kind: 'StoreLocal',
      lvalue: {kind: InstructionKind.Reassign, place: {...returnValue}},
      value: terminal.value,
      type: null,
      loc: terminal.loc,
    },
    effects: null,
  });
  block.terminal = {
    kind: 'goto',
    block: returnTarget,
    id: makeInstructionId(0),
    variant: GotoVariant.Break,
    loc: block.terminal.loc,
  };
}

Domain

Subdomains

Frequently Asked Questions

What does rewriteBlock() do?
rewriteBlock() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts.
Where is rewriteBlock() defined?
rewriteBlock() is defined in compiler/packages/babel-plugin-react-compiler/src/Inference/InlineImmediatelyInvokedFunctionExpressions.ts at line 284.
What does rewriteBlock() call?
rewriteBlock() calls 2 function(s): createTemporaryPlace, push.
What calls rewriteBlock()?
rewriteBlock() is called by 1 function(s): inlineImmediatelyInvokedFunctionExpressions.

Analyze Your Own Codebase

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

Try Supermodel Free