fixScopeAndIdentifierRanges() — react Function Reference
Architecture documentation for the fixScopeAndIdentifierRanges() function in HIRBuilder.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 04a5191f_97c5_f799_5b35_df80b526da7f["fixScopeAndIdentifierRanges()"] df6865e0_b573_e905_84d6_4eb6b419a888["HIRBuilder.ts"] 04a5191f_97c5_f799_5b35_df80b526da7f -->|defined in| df6865e0_b573_e905_84d6_4eb6b419a888 67879f67_c0fc_dc2d_b736_b9213153bc4a["buildReactiveScopeTerminalsHIR()"] 67879f67_c0fc_dc2d_b736_b9213153bc4a -->|calls| 04a5191f_97c5_f799_5b35_df80b526da7f 3522f83b_2dff_3c9f_920f_3e428eb62b31["inferEffectDependencies()"] 3522f83b_2dff_3c9f_920f_3e428eb62b31 -->|calls| 04a5191f_97c5_f799_5b35_df80b526da7f 876d58c8_bfce_a9d8_22c0_b40cc7e22553["inlineJsxTransform()"] 876d58c8_bfce_a9d8_22c0_b40cc7e22553 -->|calls| 04a5191f_97c5_f799_5b35_df80b526da7f style 04a5191f_97c5_f799_5b35_df80b526da7f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts lines 935–950
export function fixScopeAndIdentifierRanges(func: HIR): void {
for (const [, block] of func.blocks) {
const terminal = block.terminal;
if (terminal.kind === 'scope' || terminal.kind === 'pruned-scope') {
/*
* Scope ranges should always align to start at the 'scope' terminal
* and end at the first instruction of the fallthrough block
*/
const fallthroughBlock = func.blocks.get(terminal.fallthrough)!;
const firstId =
fallthroughBlock.instructions[0]?.id ?? fallthroughBlock.terminal.id;
terminal.scope.range.start = terminal.id;
terminal.scope.range.end = firstId;
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does fixScopeAndIdentifierRanges() do?
fixScopeAndIdentifierRanges() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts.
Where is fixScopeAndIdentifierRanges() defined?
fixScopeAndIdentifierRanges() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts at line 935.
What calls fixScopeAndIdentifierRanges()?
fixScopeAndIdentifierRanges() is called by 3 function(s): buildReactiveScopeTerminalsHIR, inferEffectDependencies, inlineJsxTransform.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free