Dominator Class — react Architecture
Architecture documentation for the Dominator class in Dominator.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD a3f2f330_31b9_859d_961f_8583b63a07da["Dominator"] b02a9daf_aca4_b66a_9b9b_0b739a8ca4aa["Dominator.ts"] a3f2f330_31b9_859d_961f_8583b63a07da -->|defined in| b02a9daf_aca4_b66a_9b9b_0b739a8ca4aa ff0d9e21_4a3c_0bd1_27af_47b04976238f["constructor()"] a3f2f330_31b9_859d_961f_8583b63a07da -->|method| ff0d9e21_4a3c_0bd1_27af_47b04976238f fa43ce97_9d4e_cbf6_6c19_001f052ddb51["entry()"] a3f2f330_31b9_859d_961f_8583b63a07da -->|method| fa43ce97_9d4e_cbf6_6c19_001f052ddb51 229919e6_9735_4317_1205_cd584725c183["get()"] a3f2f330_31b9_859d_961f_8583b63a07da -->|method| 229919e6_9735_4317_1205_cd584725c183 955c8008_6619_60ab_1641_87ae5ff849d7["debug()"] a3f2f330_31b9_859d_961f_8583b63a07da -->|method| 955c8008_6619_60ab_1641_87ae5ff849d7
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/Dominator.ts lines 69–106
export class Dominator<T> {
#entry: T;
#nodes: Map<T, T>;
constructor(entry: T, nodes: Map<T, T>) {
this.#entry = entry;
this.#nodes = nodes;
}
// Returns the entry node
get entry(): T {
return this.#entry;
}
/*
* Returns the immediate dominator of the block with @param id if present. Returns null
* if there is no immediate dominator (ie if the dominator is @param id itself).
*/
get(id: T): T | null {
const dominator = this.#nodes.get(id);
CompilerError.invariant(dominator !== undefined, {
reason: 'Unknown node',
loc: GeneratedSource,
});
return dominator === id ? null : dominator;
}
debug(): string {
const dominators = new Map();
for (const [key, value] of this.#nodes) {
dominators.set(`bb${key}`, `bb${value}`);
}
return prettyFormat({
entry: `bb${this.#entry}`,
dominators,
});
}
}
Domain
Source
Frequently Asked Questions
What is the Dominator class?
Dominator is a class in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/Dominator.ts.
Where is Dominator defined?
Dominator is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/Dominator.ts at line 69.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free