populateMacroTags() — react Function Reference
Architecture documentation for the populateMacroTags() function in MemoizeFbtAndMacroOperandsInSameScope.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 29a64630_c3f8_4c5c_20ff_8ad40f36ac81["populateMacroTags()"] fb4e4a7f_2a4f_a45a_81e6_48b5748e5365["MemoizeFbtAndMacroOperandsInSameScope.ts"] 29a64630_c3f8_4c5c_20ff_8ad40f36ac81 -->|defined in| fb4e4a7f_2a4f_a45a_81e6_48b5748e5365 9f7211c0_d97a_9601_5b29_f9ec90a9b7d9["memoizeFbtAndMacroOperandsInSameScope()"] 9f7211c0_d97a_9601_5b29_f9ec90a9b7d9 -->|calls| 29a64630_c3f8_4c5c_20ff_8ad40f36ac81 style 29a64630_c3f8_4c5c_20ff_8ad40f36ac81 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.ts lines 112–160
function populateMacroTags(
fn: HIRFunction,
macroKinds: Map<Macro, MacroDefinition>,
): Map<IdentifierId, MacroDefinition> {
const macroTags = new Map<IdentifierId, MacroDefinition>();
for (const block of fn.body.blocks.values()) {
for (const instr of block.instructions) {
const {lvalue, value} = instr;
switch (value.kind) {
case 'Primitive': {
if (typeof value.value === 'string') {
const macroDefinition = macroKinds.get(value.value);
if (macroDefinition != null) {
/*
* We don't distinguish between tag names and strings, so record
* all `fbt` string literals in case they are used as a jsx tag.
*/
macroTags.set(lvalue.identifier.id, macroDefinition);
}
}
break;
}
case 'LoadGlobal': {
let macroDefinition = macroKinds.get(value.binding.name);
if (macroDefinition != null) {
macroTags.set(lvalue.identifier.id, macroDefinition);
}
break;
}
case 'PropertyLoad': {
if (typeof value.property === 'string') {
const macroDefinition = macroTags.get(value.object.identifier.id);
if (macroDefinition != null) {
const propertyDefinition =
macroDefinition.properties != null
? (macroDefinition.properties.get(value.property) ??
macroDefinition.properties.get('*'))
: null;
const propertyMacro = propertyDefinition ?? macroDefinition;
macroTags.set(lvalue.identifier.id, propertyMacro);
}
}
break;
}
}
}
}
return macroTags;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does populateMacroTags() do?
populateMacroTags() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.ts.
Where is populateMacroTags() defined?
populateMacroTags() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.ts at line 112.
What calls populateMacroTags()?
populateMacroTags() is called by 1 function(s): memoizeFbtAndMacroOperandsInSameScope.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free