mapTerminalBlocks() — react Function Reference
Architecture documentation for the mapTerminalBlocks() function in visitors.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 7d3d92a3_0cc1_678c_0580_8a88df69e7d4["mapTerminalBlocks()"] 21609915_b03a_fd75_b58a_4cb86ef9315b["visitors.ts"] 7d3d92a3_0cc1_678c_0580_8a88df69e7d4 -->|defined in| 21609915_b03a_fd75_b58a_4cb86ef9315b d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"] 7d3d92a3_0cc1_678c_0580_8a88df69e7d4 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6 style 7d3d92a3_0cc1_678c_0580_8a88df69e7d4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts lines 607–666
export function mapTerminalBlocks(
terminal: ReactiveTerminal,
fn: (block: ReactiveBlock) => ReactiveBlock,
): void {
switch (terminal.kind) {
case 'break':
case 'continue':
case 'return':
case 'throw': {
break;
}
case 'for': {
terminal.loop = fn(terminal.loop);
break;
}
case 'for-of': {
terminal.loop = fn(terminal.loop);
break;
}
case 'for-in': {
terminal.loop = fn(terminal.loop);
break;
}
case 'do-while':
case 'while': {
terminal.loop = fn(terminal.loop);
break;
}
case 'if': {
terminal.consequent = fn(terminal.consequent);
if (terminal.alternate !== null) {
terminal.alternate = fn(terminal.alternate);
}
break;
}
case 'switch': {
for (const case_ of terminal.cases) {
if (case_.block !== undefined) {
case_.block = fn(case_.block);
}
}
break;
}
case 'label': {
terminal.block = fn(terminal.block);
break;
}
case 'try': {
terminal.block = fn(terminal.block);
terminal.handler = fn(terminal.handler);
break;
}
default: {
assertExhaustive(
terminal,
`Unexpected terminal kind \`${(terminal as any).kind}\``,
);
}
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does mapTerminalBlocks() do?
mapTerminalBlocks() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts.
Where is mapTerminalBlocks() defined?
mapTerminalBlocks() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts at line 607.
What does mapTerminalBlocks() call?
mapTerminalBlocks() calls 1 function(s): assertExhaustive.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free