hashEffect() — react Function Reference
Architecture documentation for the hashEffect() function in AliasingEffects.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 245c8b9a_b32e_79de_a175_090fb6c9757e["hashEffect()"] 2f00e901_2271_5b46_4d72_3fa77ff15e31["AliasingEffects.ts"] 245c8b9a_b32e_79de_a175_090fb6c9757e -->|defined in| 2f00e901_2271_5b46_4d72_3fa77ff15e31 97fe1d23_4f7c_ef28_ca5a_de2c6e376163["internEffect()"] 97fe1d23_4f7c_ef28_ca5a_de2c6e376163 -->|calls| 245c8b9a_b32e_79de_a175_090fb6c9757e f2599d2d_bbc8_cb5d_6bc8_f8d4601ee49e["printSourceLocation()"] 245c8b9a_b32e_79de_a175_090fb6c9757e -->|calls| f2599d2d_bbc8_cb5d_6bc8_f8d4601ee49e 915eda22_ad87_20ae_ed69_dc0bfeb9fb8f["primaryLocation()"] 245c8b9a_b32e_79de_a175_090fb6c9757e -->|calls| 915eda22_ad87_20ae_ed69_dc0bfeb9fb8f style 245c8b9a_b32e_79de_a175_090fb6c9757e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts lines 179–255
export function hashEffect(effect: AliasingEffect): string {
switch (effect.kind) {
case 'Apply': {
return [
effect.kind,
effect.receiver.identifier.id,
effect.function.identifier.id,
effect.mutatesFunction,
effect.args
.map(a => {
if (a.kind === 'Hole') {
return '';
} else if (a.kind === 'Identifier') {
return a.identifier.id;
} else {
return `...${a.place.identifier.id}`;
}
})
.join(','),
effect.into.identifier.id,
].join(':');
}
case 'CreateFrom':
case 'ImmutableCapture':
case 'Assign':
case 'Alias':
case 'Capture':
case 'MaybeAlias': {
return [
effect.kind,
effect.from.identifier.id,
effect.into.identifier.id,
].join(':');
}
case 'Create': {
return [
effect.kind,
effect.into.identifier.id,
effect.value,
effect.reason,
].join(':');
}
case 'Freeze': {
return [effect.kind, effect.value.identifier.id, effect.reason].join(':');
}
case 'Impure':
case 'Render': {
return [effect.kind, effect.place.identifier.id].join(':');
}
case 'MutateFrozen':
case 'MutateGlobal': {
return [
effect.kind,
effect.place.identifier.id,
effect.error.severity,
effect.error.reason,
effect.error.description,
printSourceLocation(effect.error.primaryLocation() ?? GeneratedSource),
].join(':');
}
case 'Mutate':
case 'MutateConditionally':
case 'MutateTransitive':
case 'MutateTransitiveConditionally': {
return [effect.kind, effect.value.identifier.id].join(':');
}
case 'CreateFunction': {
return [
effect.kind,
effect.into.identifier.id,
// return places are a unique way to identify functions themselves
effect.function.loweredFunc.func.returns.identifier.id,
effect.captures.map(p => p.identifier.id).join(','),
].join(':');
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does hashEffect() do?
hashEffect() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts.
Where is hashEffect() defined?
hashEffect() is defined in compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.ts at line 179.
What does hashEffect() call?
hashEffect() calls 2 function(s): primaryLocation, printSourceLocation.
What calls hashEffect()?
hashEffect() is called by 1 function(s): internEffect.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free