visit() — react Function Reference
Architecture documentation for the visit() function in ValidateContextVariableLValues.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 76301bc6_90a4_2d71_66fe_eb01715d8f65["visit()"] e43116d7_42b9_7724_244c_9ae9f04a7964["ValidateContextVariableLValues.ts"] 76301bc6_90a4_2d71_66fe_eb01715d8f65 -->|defined in| e43116d7_42b9_7724_244c_9ae9f04a7964 847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2["validateContextVariableLValuesImpl()"] 847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2 -->|calls| 76301bc6_90a4_2d71_66fe_eb01715d8f65 bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"] 76301bc6_90a4_2d71_66fe_eb01715d8f65 -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da style 76301bc6_90a4_2d71_66fe_eb01715d8f65 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateContextVariableLValues.ts lines 89–118
function visit(
identifiers: IdentifierKinds,
place: Place,
kind: 'local' | 'context' | 'destructure',
): void {
const prev = identifiers.get(place.identifier.id);
if (prev !== undefined) {
const wasContext = prev.kind === 'context';
const isContext = kind === 'context';
if (wasContext !== isContext) {
if (prev.kind === 'destructure' || kind === 'destructure') {
CompilerError.throwTodo({
reason: `Support destructuring of context variables`,
loc: kind === 'destructure' ? place.loc : prev.place.loc,
description: null,
suggestions: null,
});
}
CompilerError.invariant(false, {
reason:
'Expected all references to a variable to be consistently local or context references',
description: `Identifier ${printPlace(place)} is referenced as a ${kind} variable, but was previously referenced as a ${prev.kind} variable`,
message: `this is ${prev.kind}`,
loc: place.loc,
});
}
}
identifiers.set(place.identifier.id, {place, kind});
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does visit() do?
visit() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateContextVariableLValues.ts.
Where is visit() defined?
visit() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateContextVariableLValues.ts at line 89.
What does visit() call?
visit() calls 1 function(s): printPlace.
What calls visit()?
visit() is called by 1 function(s): validateContextVariableLValuesImpl.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free