mapTerminalSuccessors() — react Function Reference
Architecture documentation for the mapTerminalSuccessors() function in visitors.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 1e59d6f3_b074_b12f_86b8_b6d2fe62021a["mapTerminalSuccessors()"] 2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"] 1e59d6f3_b074_b12f_86b8_b6d2fe62021a -->|defined in| 2f3caf55_cc64_415c_55dd_9771ba7dc210 ce70693f_ea04_ec00_ebf7_471842f5db19["assertTerminalSuccessorsExist()"] ce70693f_ea04_ec00_ebf7_471842f5db19 -->|calls| 1e59d6f3_b074_b12f_86b8_b6d2fe62021a 00391787_ef55_81af_824a_4d0b6e524ba2["_shrink()"] 00391787_ef55_81af_824a_4d0b6e524ba2 -->|calls| 1e59d6f3_b074_b12f_86b8_b6d2fe62021a 8469c07f_bb75_970a_4a16_a21afba094e1["alignReactiveScopesToBlockScopesHIR()"] 8469c07f_bb75_970a_4a16_a21afba094e1 -->|calls| 1e59d6f3_b074_b12f_86b8_b6d2fe62021a d0270ab6_a621_bd55_a1b9_a5cad8b406b2["makeInstructionId()"] 1e59d6f3_b074_b12f_86b8_b6d2fe62021a -->|calls| d0270ab6_a621_bd55_a1b9_a5cad8b406b2 d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"] 1e59d6f3_b074_b12f_86b8_b6d2fe62021a -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6 style 1e59d6f3_b074_b12f_86b8_b6d2fe62021a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts lines 708–960
export function mapTerminalSuccessors(
terminal: Terminal,
fn: (block: BlockId) => BlockId,
): Terminal {
switch (terminal.kind) {
case 'goto': {
const target = fn(terminal.block);
return {
kind: 'goto',
block: target,
variant: terminal.variant,
id: makeInstructionId(0),
loc: terminal.loc,
};
}
case 'if': {
const consequent = fn(terminal.consequent);
const alternate = fn(terminal.alternate);
const fallthrough = fn(terminal.fallthrough);
return {
kind: 'if',
test: terminal.test,
consequent,
alternate,
fallthrough,
id: makeInstructionId(0),
loc: terminal.loc,
};
}
case 'branch': {
const consequent = fn(terminal.consequent);
const alternate = fn(terminal.alternate);
const fallthrough = fn(terminal.fallthrough);
return {
kind: 'branch',
test: terminal.test,
consequent,
alternate,
fallthrough,
id: makeInstructionId(0),
loc: terminal.loc,
};
}
case 'switch': {
const cases = terminal.cases.map(case_ => {
const target = fn(case_.block);
return {
test: case_.test,
block: target,
};
});
const fallthrough = fn(terminal.fallthrough);
return {
kind: 'switch',
test: terminal.test,
cases,
fallthrough,
id: makeInstructionId(0),
loc: terminal.loc,
};
}
case 'logical': {
const test = fn(terminal.test);
const fallthrough = fn(terminal.fallthrough);
return {
kind: 'logical',
test,
fallthrough,
operator: terminal.operator,
id: makeInstructionId(0),
loc: terminal.loc,
};
}
case 'ternary': {
const test = fn(terminal.test);
const fallthrough = fn(terminal.fallthrough);
return {
kind: 'ternary',
test,
fallthrough,
id: makeInstructionId(0),
Domain
Subdomains
Source
Frequently Asked Questions
What does mapTerminalSuccessors() do?
mapTerminalSuccessors() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts.
Where is mapTerminalSuccessors() defined?
mapTerminalSuccessors() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts at line 708.
What does mapTerminalSuccessors() call?
mapTerminalSuccessors() calls 2 function(s): assertExhaustive, makeInstructionId.
What calls mapTerminalSuccessors()?
mapTerminalSuccessors() is called by 3 function(s): _shrink, alignReactiveScopesToBlockScopesHIR, assertTerminalSuccessorsExist.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free