Home / Function/ label() — react Function Reference

label() — react Function Reference

Architecture documentation for the label() function in HIRBuilder.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  42c54eec_61e2_4541_5013_95a2469e5670["label()"]
  d1b85268_f4cd_bc3c_7ba0_ee15dcc8a845["HIRBuilder"]
  42c54eec_61e2_4541_5013_95a2469e5670 -->|defined in| d1b85268_f4cd_bc3c_7ba0_ee15dcc8a845
  c01b12bd_811d_9f90_f641_fac8e518dbb7["lowerStatement()"]
  c01b12bd_811d_9f90_f641_fac8e518dbb7 -->|calls| 42c54eec_61e2_4541_5013_95a2469e5670
  53244187_914c_cc90_5880_7bfc1fc9c0bb["push()"]
  42c54eec_61e2_4541_5013_95a2469e5670 -->|calls| 53244187_914c_cc90_5880_7bfc1fc9c0bb
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  42c54eec_61e2_4541_5013_95a2469e5670 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  style 42c54eec_61e2_4541_5013_95a2469e5670 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts lines 494–513

  label<T>(label: string, breakBlock: BlockId, fn: () => T): T {
    this.#scopes.push({
      kind: 'label',
      breakBlock,
      label,
    });
    const value = fn();
    const last = this.#scopes.pop();
    CompilerError.invariant(
      last != null &&
        last.kind === 'label' &&
        last.label === label &&
        last.breakBlock === breakBlock,
      {
        reason: 'Mismatched label',
        loc: GeneratedSource,
      },
    );
    return value;
  }

Subdomains

Called By

Frequently Asked Questions

What does label() do?
label() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts.
Where is label() defined?
label() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts at line 494.
What does label() call?
label() calls 2 function(s): invariant, push.
What calls label()?
label() is called by 1 function(s): lowerStatement.

Analyze Your Own Codebase

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

Try Supermodel Free