findScopesToMerge() — react Function Reference
Architecture documentation for the findScopesToMerge() function in AlignObjectMethodScopes.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 3ca82b1b_8445_ebe9_bd74_246c70e0a1d7["findScopesToMerge()"] ccdefd56_943b_4a93_dbef_8990d03b145e["AlignObjectMethodScopes.ts"] 3ca82b1b_8445_ebe9_bd74_246c70e0a1d7 -->|defined in| ccdefd56_943b_4a93_dbef_8990d03b145e a43c96d5_a86c_d0aa_2d0b_5c42b235a002["alignObjectMethodScopes()"] a43c96d5_a86c_d0aa_2d0b_5c42b235a002 -->|calls| 3ca82b1b_8445_ebe9_bd74_246c70e0a1d7 a04516ec_2832_c7f7_0927_f3bdd7fab903["eachInstructionValueOperand()"] 3ca82b1b_8445_ebe9_bd74_246c70e0a1d7 -->|calls| a04516ec_2832_c7f7_0927_f3bdd7fab903 644a5691_1e35_dd45_a1ab_5f7e2c9de006["has()"] 3ca82b1b_8445_ebe9_bd74_246c70e0a1d7 -->|calls| 644a5691_1e35_dd45_a1ab_5f7e2c9de006 style 3ca82b1b_8445_ebe9_bd74_246c70e0a1d7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/AlignObjectMethodScopes.ts lines 25–54
function findScopesToMerge(fn: HIRFunction): DisjointSet<ReactiveScope> {
const objectMethodDecls: Set<Identifier> = new Set();
const mergeScopesBuilder = new DisjointSet<ReactiveScope>();
for (const [_, block] of fn.body.blocks) {
for (const {lvalue, value} of block.instructions) {
if (value.kind === 'ObjectMethod') {
objectMethodDecls.add(lvalue.identifier);
} else if (value.kind === 'ObjectExpression') {
for (const operand of eachInstructionValueOperand(value)) {
if (objectMethodDecls.has(operand.identifier)) {
const operandScope = operand.identifier.scope;
const lvalueScope = lvalue.identifier.scope;
CompilerError.invariant(
operandScope != null && lvalueScope != null,
{
reason:
'Internal error: Expected all ObjectExpressions and ObjectMethods to have non-null scope.',
loc: GeneratedSource,
},
);
mergeScopesBuilder.union([operandScope, lvalueScope]);
}
}
}
}
}
return mergeScopesBuilder;
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does findScopesToMerge() do?
findScopesToMerge() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/AlignObjectMethodScopes.ts.
Where is findScopesToMerge() defined?
findScopesToMerge() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/AlignObjectMethodScopes.ts at line 25.
What does findScopesToMerge() call?
findScopesToMerge() calls 2 function(s): eachInstructionValueOperand, has.
What calls findScopesToMerge()?
findScopesToMerge() is called by 1 function(s): alignObjectMethodScopes.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free