merge() — react Function Reference
Architecture documentation for the merge() function in DeriveMinimalDependenciesHIR.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD fde4af26_13b5_6adc_3afe_f724f66c9a93["merge()"] 686094a4_f90a_6b2e_949a_aa03f03b5c66["DeriveMinimalDependenciesHIR.ts"] fde4af26_13b5_6adc_3afe_f724f66c9a93 -->|defined in| 686094a4_f90a_6b2e_949a_aa03f03b5c66 61f036d0_eb91_7e31_154e_acb3c7c8f23c["addDependency()"] 61f036d0_eb91_7e31_154e_acb3c7c8f23c -->|calls| fde4af26_13b5_6adc_3afe_f724f66c9a93 38ab4c9b_814c_2f1c_3661_630e72f557fd["makeOrMergeProperty()"] 38ab4c9b_814c_2f1c_3661_630e72f557fd -->|calls| fde4af26_13b5_6adc_3afe_f724f66c9a93 7930cad6_ab99_ae3b_5cac_03042fe5727b["merge()"] fde4af26_13b5_6adc_3afe_f724f66c9a93 -->|calls| 7930cad6_ab99_ae3b_5cac_03042fe5727b 313f0afe_6db1_bf05_f22c_502906b24f00["isOptional()"] fde4af26_13b5_6adc_3afe_f724f66c9a93 -->|calls| 313f0afe_6db1_bf05_f22c_502906b24f00 6a38958d_320b_9a16_a7b1_b21a4633841c["isDependency()"] fde4af26_13b5_6adc_3afe_f724f66c9a93 -->|calls| 6a38958d_320b_9a16_a7b1_b21a4633841c style fde4af26_13b5_6adc_3afe_f724f66c9a93 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/DeriveMinimalDependenciesHIR.ts lines 275–304
function merge(
access1: PropertyAccessType,
access2: PropertyAccessType,
): PropertyAccessType {
const resultIsUnconditional = !(isOptional(access1) && isOptional(access2));
const resultIsDependency = isDependency(access1) || isDependency(access2);
/*
* Straightforward merge.
* This can be represented as bitwise OR, but is written out for readability
*
* Observe that `UnconditionalAccess | ConditionalDependency` produces an
* unconditionally accessed conditional dependency. We currently use these
* as we use unconditional dependencies. (i.e. to codegen change variables)
*/
if (resultIsUnconditional) {
if (resultIsDependency) {
return PropertyAccessType.UnconditionalDependency;
} else {
return PropertyAccessType.UnconditionalAccess;
}
} else {
// result is optional
if (resultIsDependency) {
return PropertyAccessType.OptionalDependency;
} else {
return PropertyAccessType.OptionalAccess;
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does merge() do?
merge() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/DeriveMinimalDependenciesHIR.ts.
Where is merge() defined?
merge() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/DeriveMinimalDependenciesHIR.ts at line 275.
What does merge() call?
merge() calls 3 function(s): isDependency, isOptional, merge.
What calls merge()?
merge() is called by 2 function(s): addDependency, makeOrMergeProperty.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free