Home / Function/ visitTestBlock() — react Function Reference

visitTestBlock() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  bae7b350_498b_eec1_68c2_7ca15568b2bb["visitTestBlock()"]
  e20dc57f_069b_7065_293d_92b4bae116ae["Driver"]
  bae7b350_498b_eec1_68c2_7ca15568b2bb -->|defined in| e20dc57f_069b_7065_293d_92b4bae116ae
  69119c39_6bb5_7c2b_0712_73f7e045a58d["visitValueBlockTerminal()"]
  69119c39_6bb5_7c2b_0712_73f7e045a58d -->|calls| bae7b350_498b_eec1_68c2_7ca15568b2bb
  21ce7ec8_0512_fc1a_b5e4_cc6bfd19ca66["visitValueBlock()"]
  bae7b350_498b_eec1_68c2_7ca15568b2bb -->|calls| 21ce7ec8_0512_fc1a_b5e4_cc6bfd19ca66
  cf8d627e_c2f0_6cd4_e5fc_35f3c7005b64["throwTodo()"]
  bae7b350_498b_eec1_68c2_7ca15568b2bb -->|calls| cf8d627e_c2f0_6cd4_e5fc_35f3c7005b64
  style bae7b350_498b_eec1_68c2_7ca15568b2bb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts lines 994–1025

  visitTestBlock(
    testBlockId: BlockId,
    loc: SourceLocation,
    terminalKind: string,
  ): {
    test: {
      block: BlockId;
      value: ReactiveValue;
      place: Place;
      id: InstructionId;
    };
    branch: {consequent: BlockId; alternate: BlockId; loc: SourceLocation};
  } {
    const test = this.visitValueBlock(testBlockId, loc);
    const testBlock = this.cx.ir.blocks.get(test.block)!;
    if (testBlock.terminal.kind !== 'branch') {
      CompilerError.throwTodo({
        reason: `Unexpected terminal kind \`${testBlock.terminal.kind}\` for ${terminalKind} test block`,
        description: null,
        loc: testBlock.terminal.loc,
        suggestions: null,
      });
    }
    return {
      test,
      branch: {
        consequent: testBlock.terminal.consequent,
        alternate: testBlock.terminal.alternate,
        loc: testBlock.terminal.loc,
      },
    };
  }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free