Home / Function/ extractValueBlockResult() — react Function Reference

extractValueBlockResult() — react Function Reference

Architecture documentation for the extractValueBlockResult() function in BuildReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a043b9e3_4ef5_e5b0_f9fd_9ba1c267ff17["extractValueBlockResult()"]
  e20dc57f_069b_7065_293d_92b4bae116ae["Driver"]
  a043b9e3_4ef5_e5b0_f9fd_9ba1c267ff17 -->|defined in| e20dc57f_069b_7065_293d_92b4bae116ae
  21ce7ec8_0512_fc1a_b5e4_cc6bfd19ca66["visitValueBlock()"]
  21ce7ec8_0512_fc1a_b5e4_cc6bfd19ca66 -->|calls| a043b9e3_4ef5_e5b0_f9fd_9ba1c267ff17
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  a043b9e3_4ef5_e5b0_f9fd_9ba1c267ff17 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  style a043b9e3_4ef5_e5b0_f9fd_9ba1c267ff17 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts lines 107–142

  extractValueBlockResult(
    instructions: BasicBlock['instructions'],
    blockId: BlockId,
    loc: SourceLocation,
  ): {block: BlockId; place: Place; value: ReactiveValue; id: InstructionId} {
    CompilerError.invariant(instructions.length !== 0, {
      reason: `Expected non-empty instructions in extractValueBlockResult`,
      description: null,
      loc,
    });
    const instr = instructions.at(-1)!;
    let place: Place = instr.lvalue;
    let value: ReactiveValue = instr.value;
    if (
      value.kind === 'StoreLocal' &&
      value.lvalue.place.identifier.name === null
    ) {
      place = value.lvalue.place;
      value = {
        kind: 'LoadLocal',
        place: value.value,
        loc: value.value.loc,
      };
    }
    if (instructions.length === 1) {
      return {block: blockId, place, value, id: instr.id};
    }
    const sequence: ReactiveSequenceValue = {
      kind: 'SequenceExpression',
      instructions: instructions.slice(0, -1),
      id: instr.id,
      value,
      loc,
    };
    return {block: blockId, place, value: sequence, id: instr.id};
  }

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does extractValueBlockResult() do?
extractValueBlockResult() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts.
Where is extractValueBlockResult() defined?
extractValueBlockResult() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts at line 107.
What does extractValueBlockResult() call?
extractValueBlockResult() calls 1 function(s): invariant.
What calls extractValueBlockResult()?
extractValueBlockResult() is called by 1 function(s): visitValueBlock.

Analyze Your Own Codebase

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

Try Supermodel Free