getOrCreateIdentifier() — react Function Reference
Architecture documentation for the getOrCreateIdentifier() function in CollectHoistablePropertyLoads.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 084ee472_d720_c32a_2f8a_dffbbb1be6af["getOrCreateIdentifier()"] 50c372df_146d_1b4c_de3a_0589d6591a75["PropertyPathRegistry"] 084ee472_d720_c32a_2f8a_dffbbb1be6af -->|defined in| 50c372df_146d_1b4c_de3a_0589d6591a75 afcd35a2_87ac_64f3_d39b_e78954698dc0["getOrCreateProperty()"] afcd35a2_87ac_64f3_d39b_e78954698dc0 -->|calls| 084ee472_d720_c32a_2f8a_dffbbb1be6af 2c85e7b5_d003_b439_dc7b_cb881996ea23["collectNonNullsInBlocks()"] 2c85e7b5_d003_b439_dc7b_cb881996ea23 -->|calls| 084ee472_d720_c32a_2f8a_dffbbb1be6af bc0d4a49_256e_973f_feb6_ed785896b72b["reduceMaybeOptionalChains()"] bc0d4a49_256e_973f_feb6_ed785896b72b -->|calls| 084ee472_d720_c32a_2f8a_dffbbb1be6af 041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"] 084ee472_d720_c32a_2f8a_dffbbb1be6af -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e style 084ee472_d720_c32a_2f8a_dffbbb1be6af fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts lines 244–276
getOrCreateIdentifier(
identifier: Identifier,
reactive: boolean,
): PropertyPathNode {
/**
* Reads from a statically scoped variable are always safe in JS,
* with the exception of TDZ (not addressed by this pass).
*/
let rootNode = this.roots.get(identifier.id);
if (rootNode === undefined) {
rootNode = {
root: identifier.id,
properties: new Map(),
optionalProperties: new Map(),
fullPath: {
identifier,
reactive,
path: [],
},
hasOptional: false,
parent: null,
};
this.roots.set(identifier.id, rootNode);
} else {
CompilerError.invariant(reactive === rootNode.fullPath.reactive, {
reason:
'[HoistablePropertyLoads] Found inconsistencies in `reactive` flag when deduping identifier reads within the same scope',
loc: identifier.loc,
});
}
return rootNode;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does getOrCreateIdentifier() do?
getOrCreateIdentifier() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts.
Where is getOrCreateIdentifier() defined?
getOrCreateIdentifier() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts at line 244.
What does getOrCreateIdentifier() call?
getOrCreateIdentifier() calls 1 function(s): invariant.
What calls getOrCreateIdentifier()?
getOrCreateIdentifier() is called by 3 function(s): collectNonNullsInBlocks, getOrCreateProperty, reduceMaybeOptionalChains.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free