printPattern() — react Function Reference
Architecture documentation for the printPattern() function in PrintHIR.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD cd2a20a9_1741_622b_6efc_d63bea24cb4c["printPattern()"] 6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"] cd2a20a9_1741_622b_6efc_d63bea24cb4c -->|defined in| 6976a9ee_9d8e_4f16_3016_495f39aff2fd f3619b34_2818_79d3_d2a6_72b9bcfc9d1e["printInstructionValue()"] f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| cd2a20a9_1741_622b_6efc_d63bea24cb4c 8feba833_c46a_51b7_3da0_fcdfe54673b7["printObjectPropertyKey()"] cd2a20a9_1741_622b_6efc_d63bea24cb4c -->|calls| 8feba833_c46a_51b7_3da0_fcdfe54673b7 d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"] cd2a20a9_1741_622b_6efc_d63bea24cb4c -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6 bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"] cd2a20a9_1741_622b_6efc_d63bea24cb4c -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da style cd2a20a9_1741_622b_6efc_d63bea24cb4c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts lines 780–832
export function printPattern(pattern: Pattern | Place | SpreadPattern): string {
switch (pattern.kind) {
case 'ArrayPattern': {
return (
'[ ' +
pattern.items
.map(item => {
if (item.kind === 'Hole') {
return '<hole>';
}
return printPattern(item);
})
.join(', ') +
' ]'
);
}
case 'ObjectPattern': {
return (
'{ ' +
pattern.properties
.map(item => {
switch (item.kind) {
case 'ObjectProperty': {
return `${printObjectPropertyKey(item.key)}: ${printPattern(
item.place,
)}`;
}
case 'Spread': {
return printPattern(item);
}
default: {
assertExhaustive(item, 'Unexpected object property kind');
}
}
})
.join(', ') +
' }'
);
}
case 'Spread': {
return `...${printPlace(pattern.place)}`;
}
case 'Identifier': {
return printPlace(pattern);
}
default: {
assertExhaustive(
pattern,
`Unexpected pattern kind \`${(pattern as any).kind}\``,
);
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does printPattern() do?
printPattern() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts.
Where is printPattern() defined?
printPattern() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts at line 780.
What does printPattern() call?
printPattern() calls 3 function(s): assertExhaustive, printObjectPropertyKey, printPlace.
What calls printPattern()?
printPattern() is called by 1 function(s): printInstructionValue.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free