RewriteBlockIds Class — react Architecture
Architecture documentation for the RewriteBlockIds class in StabilizeBlockIds.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 018a4be0_a806_4852_96cb_ce5417b70e5d["RewriteBlockIds"] cc16bb5e_e9d5_74bd_0764_79875a9ffa5b["StabilizeBlockIds.ts"] 018a4be0_a806_4852_96cb_ce5417b70e5d -->|defined in| cc16bb5e_e9d5_74bd_0764_79875a9ffa5b 159d2ac9_417f_4dd5_267f_2b3dd2be80ce["visitScope()"] 018a4be0_a806_4852_96cb_ce5417b70e5d -->|method| 159d2ac9_417f_4dd5_267f_2b3dd2be80ce 8f15af1e_7e01_3717_a54f_6134e46e8d14["visitTerminal()"] 018a4be0_a806_4852_96cb_ce5417b70e5d -->|method| 8f15af1e_7e01_3717_a54f_6134e46e8d14
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/StabilizeBlockIds.ts lines 51–87
class RewriteBlockIds extends ReactiveFunctionVisitor<Map<BlockId, BlockId>> {
override visitScope(
scope: ReactiveScopeBlock,
state: Map<BlockId, BlockId>,
): void {
const {earlyReturnValue} = scope.scope;
if (earlyReturnValue != null) {
const rewrittenId = getOrInsertDefault(
state,
earlyReturnValue.label,
state.size,
);
earlyReturnValue.label = makeBlockId(rewrittenId);
}
this.traverseScope(scope, state);
}
override visitTerminal(
stmt: ReactiveTerminalStatement,
state: Map<BlockId, BlockId>,
): void {
if (stmt.label != null) {
const rewrittenId = getOrInsertDefault(state, stmt.label.id, state.size);
stmt.label.id = makeBlockId(rewrittenId);
}
const terminal = stmt.terminal;
if (terminal.kind === 'break' || terminal.kind === 'continue') {
const rewrittenId = getOrInsertDefault(
state,
terminal.target,
state.size,
);
terminal.target = makeBlockId(rewrittenId);
}
this.traverseTerminal(stmt, state);
}
}
Domain
Source
Frequently Asked Questions
What is the RewriteBlockIds class?
RewriteBlockIds is a class in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/StabilizeBlockIds.ts.
Where is RewriteBlockIds defined?
RewriteBlockIds is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/StabilizeBlockIds.ts at line 51.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free