printTerminal() — react Function Reference
Architecture documentation for the printTerminal() function in PrintHIR.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 809a0fbd_e458_a174_789b_dc2fd017231a["printTerminal()"] 6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"] 809a0fbd_e458_a174_789b_dc2fd017231a -->|defined in| 6976a9ee_9d8e_4f16_3016_495f39aff2fd ce70693f_ea04_ec00_ebf7_471842f5db19["assertTerminalSuccessorsExist()"] ce70693f_ea04_ec00_ebf7_471842f5db19 -->|calls| 809a0fbd_e458_a174_789b_dc2fd017231a 3f9f0373_2e57_1356_bd68_e2eec897e2f5["printHIR()"] 3f9f0373_2e57_1356_bd68_e2eec897e2f5 -->|calls| 809a0fbd_e458_a174_789b_dc2fd017231a 27402418_1586_dfa4_858b_40693675cab9["printMixedHIR()"] 27402418_1586_dfa4_858b_40693675cab9 -->|calls| 809a0fbd_e458_a174_789b_dc2fd017231a bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"] 809a0fbd_e458_a174_789b_dc2fd017231a -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da 073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"] 809a0fbd_e458_a174_789b_dc2fd017231a -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83 4c434fb2_75ab_6c2c_c237_b1d38a1b0141["forEach()"] 809a0fbd_e458_a174_789b_dc2fd017231a -->|calls| 4c434fb2_75ab_6c2c_c237_b1d38a1b0141 694a6a07_b3ca_4ab4_beba_18f4053a49f2["printReactiveScopeSummary()"] 809a0fbd_e458_a174_789b_dc2fd017231a -->|calls| 694a6a07_b3ca_4ab4_beba_18f4053a49f2 d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"] 809a0fbd_e458_a174_789b_dc2fd017231a -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6 style 809a0fbd_e458_a174_789b_dc2fd017231a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts lines 187–334
export function printTerminal(terminal: Terminal): Array<string> | string {
let value;
switch (terminal.kind) {
case 'if': {
value = `[${terminal.id}] If (${printPlace(terminal.test)}) then:bb${
terminal.consequent
} else:bb${terminal.alternate}${
terminal.fallthrough ? ` fallthrough=bb${terminal.fallthrough}` : ''
}`;
break;
}
case 'branch': {
value = `[${terminal.id}] Branch (${printPlace(terminal.test)}) then:bb${
terminal.consequent
} else:bb${terminal.alternate} fallthrough:bb${terminal.fallthrough}`;
break;
}
case 'logical': {
value = `[${terminal.id}] Logical ${terminal.operator} test:bb${terminal.test} fallthrough=bb${terminal.fallthrough}`;
break;
}
case 'ternary': {
value = `[${terminal.id}] Ternary test:bb${terminal.test} fallthrough=bb${terminal.fallthrough}`;
break;
}
case 'optional': {
value = `[${terminal.id}] Optional (optional=${terminal.optional}) test:bb${terminal.test} fallthrough=bb${terminal.fallthrough}`;
break;
}
case 'throw': {
value = `[${terminal.id}] Throw ${printPlace(terminal.value)}`;
break;
}
case 'return': {
value = `[${terminal.id}] Return ${terminal.returnVariant}${
terminal.value != null ? ' ' + printPlace(terminal.value) : ''
}`;
if (terminal.effects != null) {
value += `\n ${terminal.effects.map(printAliasingEffect).join('\n ')}`;
}
break;
}
case 'goto': {
value = `[${terminal.id}] Goto${
terminal.variant === GotoVariant.Continue ? '(Continue)' : ''
} bb${terminal.block}`;
break;
}
case 'switch': {
const output = [];
output.push(`[${terminal.id}] Switch (${printPlace(terminal.test)})`);
terminal.cases.forEach(case_ => {
if (case_.test !== null) {
output.push(` Case ${printPlace(case_.test)}: bb${case_.block}`);
} else {
output.push(` Default: bb${case_.block}`);
}
});
if (terminal.fallthrough) {
output.push(` Fallthrough: bb${terminal.fallthrough}`);
}
value = output;
break;
}
case 'do-while': {
value = `[${terminal.id}] DoWhile loop=${`bb${terminal.loop}`} test=bb${
terminal.test
} fallthrough=${`bb${terminal.fallthrough}`}`;
break;
}
case 'while': {
value = `[${terminal.id}] While test=bb${terminal.test} loop=${
terminal.loop !== null ? `bb${terminal.loop}` : ''
} fallthrough=${terminal.fallthrough ? `bb${terminal.fallthrough}` : ''}`;
break;
}
case 'for': {
value = `[${terminal.id}] For init=bb${terminal.init} test=bb${terminal.test} loop=bb${terminal.loop} update=bb${terminal.update} fallthrough=bb${terminal.fallthrough}`;
break;
}
case 'for-of': {
Domain
Subdomains
Source
Frequently Asked Questions
What does printTerminal() do?
printTerminal() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts.
Where is printTerminal() defined?
printTerminal() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts at line 187.
What does printTerminal() call?
printTerminal() calls 5 function(s): assertExhaustive, forEach, printPlace, printReactiveScopeSummary, push.
What calls printTerminal()?
printTerminal() is called by 3 function(s): assertTerminalSuccessorsExist, printHIR, printMixedHIR.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free