Visitor Class — react Architecture
Architecture documentation for the Visitor class in RenameVariables.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 3ec9ad0b_e058_4e7f_19c6_b276581f7487["Visitor"] a67a8ce3_d9a8_a740_fb57_bc90354f75e7["RenameVariables.ts"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|defined in| a67a8ce3_d9a8_a740_fb57_bc90354f75e7 80786b50_8518_5cd7_d9be_c0451e4458b9["visitParam()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| 80786b50_8518_5cd7_d9be_c0451e4458b9 f90d8dc1_64eb_084c_5c44_6858b6b758c6["visitLValue()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| f90d8dc1_64eb_084c_5c44_6858b6b758c6 81ab854c_18a9_da4f_9b20_d5e7b20d6a0b["visitPlace()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| 81ab854c_18a9_da4f_9b20_d5e7b20d6a0b 8c7d9d3d_b681_0556_c6cf_c86359d85bee["visitBlock()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| 8c7d9d3d_b681_0556_c6cf_c86359d85bee a0d79c92_0677_bb82_4af7_c2bc582087a7["visitPrunedScope()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| a0d79c92_0677_bb82_4af7_c2bc582087a7 a3e340dd_fd2c_8bf8_f396_ba5c6082fee4["visitScope()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| a3e340dd_fd2c_8bf8_f396_ba5c6082fee4 11bb7b21_44b4_666c_d428_28ac86902860["visitValue()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| 11bb7b21_44b4_666c_d428_28ac86902860 408ed4fd_063f_c630_9694_33dc407cdb14["visitReactiveFunctionValue()"] 3ec9ad0b_e058_4e7f_19c6_b276581f7487 -->|method| 408ed4fd_063f_c630_9694_33dc407cdb14
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/RenameVariables.ts lines 74–123
class Visitor extends ReactiveFunctionVisitor<Scopes> {
override visitParam(place: Place, state: Scopes): void {
state.visit(place.identifier);
}
override visitLValue(_id: InstructionId, lvalue: Place, state: Scopes): void {
state.visit(lvalue.identifier);
}
override visitPlace(id: InstructionId, place: Place, state: Scopes): void {
state.visit(place.identifier);
}
override visitBlock(block: ReactiveBlock, state: Scopes): void {
state.enter(() => {
this.traverseBlock(block, state);
});
}
override visitPrunedScope(
scopeBlock: PrunedReactiveScopeBlock,
state: Scopes,
): void {
this.traverseBlock(scopeBlock.instructions, state);
}
override visitScope(scope: ReactiveScopeBlock, state: Scopes): void {
for (const [_, declaration] of scope.scope.declarations) {
state.visit(declaration.identifier);
}
this.traverseScope(scope, state);
}
override visitValue(
id: InstructionId,
value: ReactiveValue,
state: Scopes,
): void {
this.traverseValue(id, value, state);
if (value.kind === 'FunctionExpression' || value.kind === 'ObjectMethod') {
this.visitHirFunction(value.loweredFunc.func, state);
}
}
override visitReactiveFunctionValue(
_id: InstructionId,
_dependencies: Array<Place>,
_fn: ReactiveFunction,
_state: Scopes,
): void {
renameVariablesImpl(_fn, this, _state);
}
}
Domain
Source
Frequently Asked Questions
What is the Visitor class?
Visitor is a class in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/RenameVariables.ts.
Where is Visitor defined?
Visitor is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/RenameVariables.ts at line 74.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free