switch() — react Function Reference
Architecture documentation for the switch() function in HIRBuilder.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 0a9966a2_2d1e_317c_367a_626218fcea7b["switch()"] d1b85268_f4cd_bc3c_7ba0_ee15dcc8a845["HIRBuilder"] 0a9966a2_2d1e_317c_367a_626218fcea7b -->|defined in| d1b85268_f4cd_bc3c_7ba0_ee15dcc8a845 53244187_914c_cc90_5880_7bfc1fc9c0bb["push()"] 0a9966a2_2d1e_317c_367a_626218fcea7b -->|calls| 53244187_914c_cc90_5880_7bfc1fc9c0bb 041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"] 0a9966a2_2d1e_317c_367a_626218fcea7b -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e style 0a9966a2_2d1e_317c_367a_626218fcea7b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts lines 515–534
switch<T>(label: string | null, breakBlock: BlockId, fn: () => T): T {
this.#scopes.push({
kind: 'switch',
breakBlock,
label,
});
const value = fn();
const last = this.#scopes.pop();
CompilerError.invariant(
last != null &&
last.kind === 'switch' &&
last.label === label &&
last.breakBlock === breakBlock,
{
reason: 'Mismatched label',
loc: GeneratedSource,
},
);
return value;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does switch() do?
switch() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts.
Where is switch() defined?
switch() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts at line 515.
What does switch() call?
switch() calls 2 function(s): invariant, push.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free