Home / Function/ valueBlockResultToSequence() — react Function Reference

valueBlockResultToSequence() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  94607a28_ed02_b0d5_72b8_7b074efdebad["valueBlockResultToSequence()"]
  e20dc57f_069b_7065_293d_92b4bae116ae["Driver"]
  94607a28_ed02_b0d5_72b8_7b074efdebad -->|defined in| e20dc57f_069b_7065_293d_92b4bae116ae
  59c4bc0e_ec5f_af0c_d67c_d518b3f117bc["visitBlock()"]
  59c4bc0e_ec5f_af0c_d67c_d518b3f117bc -->|calls| 94607a28_ed02_b0d5_72b8_7b074efdebad
  073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"]
  94607a28_ed02_b0d5_72b8_7b074efdebad -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83
  style 94607a28_ed02_b0d5_72b8_7b074efdebad fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts lines 152–197

  valueBlockResultToSequence(
    result: {
      block: BlockId;
      value: ReactiveValue;
      place: Place;
      id: InstructionId;
    },
    loc: SourceLocation,
  ): ReactiveSequenceValue {
    // Collect all instructions from potentially nested SequenceExpressions
    const instructions: Array<ReactiveInstruction> = [];
    let innerValue: ReactiveValue = result.value;

    // Flatten nested SequenceExpressions
    while (innerValue.kind === 'SequenceExpression') {
      instructions.push(...innerValue.instructions);
      innerValue = innerValue.value;
    }

    /*
     * Only add the final instruction if the innermost value is not just a LoadLocal
     * of the same place we're storing to (which would be a no-op).
     * This happens when MaybeThrow blocks cause the sequence to already contain
     * all the necessary instructions.
     */
    const isLoadOfSamePlace =
      innerValue.kind === 'LoadLocal' &&
      innerValue.place.identifier.id === result.place.identifier.id;

    if (!isLoadOfSamePlace) {
      instructions.push({
        id: result.id,
        lvalue: result.place,
        value: innerValue,
        loc,
      });
    }

    return {
      kind: 'SequenceExpression',
      instructions,
      id: result.id,
      value: {kind: 'Primitive', value: undefined, loc},
      loc,
    };
  }

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free