transformInstruction() — react Function Reference
Architecture documentation for the transformInstruction() function in ExtractScopeDeclarationsFromDestructuring.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD cc0d3b4e_a169_bc13_335d_35432b193034["transformInstruction()"] b58ba090_1fb5_5776_b61b_d8510ef16394["Visitor"] cc0d3b4e_a169_bc13_335d_35432b193034 -->|defined in| b58ba090_1fb5_5776_b61b_d8510ef16394 af4d3127_0abf_3e44_50a8_d7a9dd0b9b58["visitInstruction()"] cc0d3b4e_a169_bc13_335d_35432b193034 -->|calls| af4d3127_0abf_3e44_50a8_d7a9dd0b9b58 40802d10_d9f1_10c2_2fff_626026f88fb4["transformInstruction()"] cc0d3b4e_a169_bc13_335d_35432b193034 -->|calls| 40802d10_d9f1_10c2_2fff_626026f88fb4 fb7d5dbf_1b8e_624d_5b62_7b7a22eeb272["transformDestructuring()"] cc0d3b4e_a169_bc13_335d_35432b193034 -->|calls| fb7d5dbf_1b8e_624d_5b62_7b7a22eeb272 ebfb2dff_a701_0b9f_5a9e_8cd734914a21["eachInstructionLValueWithKind()"] cc0d3b4e_a169_bc13_335d_35432b193034 -->|calls| ebfb2dff_a701_0b9f_5a9e_8cd734914a21 style cc0d3b4e_a169_bc13_335d_35432b193034 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/ExtractScopeDeclarationsFromDestructuring.ts lines 114–151
override transformInstruction(
instruction: ReactiveInstruction,
state: State,
): Transformed<ReactiveStatement> {
this.visitInstruction(instruction, state);
let instructionsToProcess: Array<ReactiveInstruction> = [instruction];
let result: Transformed<ReactiveStatement> = {kind: 'keep'};
if (instruction.value.kind === 'Destructure') {
const transformed = transformDestructuring(
state,
instruction,
instruction.value,
);
if (transformed) {
instructionsToProcess = transformed;
result = {
kind: 'replace-many',
value: transformed.map(instruction => ({
kind: 'instruction',
instruction,
})),
};
}
}
// Update state.declared with declarations from the instruction(s)
for (const instr of instructionsToProcess) {
for (const [place, kind] of eachInstructionLValueWithKind(instr)) {
if (kind !== InstructionKind.Reassign) {
state.declared.add(place.identifier.declarationId);
}
}
}
return result;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does transformInstruction() do?
transformInstruction() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/ExtractScopeDeclarationsFromDestructuring.ts.
Where is transformInstruction() defined?
transformInstruction() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/ExtractScopeDeclarationsFromDestructuring.ts at line 114.
What does transformInstruction() call?
transformInstruction() calls 4 function(s): eachInstructionLValueWithKind, transformDestructuring, transformInstruction, visitInstruction.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free