emitSelectorFn() — react Function Reference
Architecture documentation for the emitSelectorFn() function in LowerContextAccess.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD c059451e_3ed5_62a9_6995_a4adbca6d62c["emitSelectorFn()"] ed770299_f9db_61d4_407c_b8ead52e24ec["LowerContextAccess.ts"] c059451e_3ed5_62a9_6995_a4adbca6d62c -->|defined in| ed770299_f9db_61d4_407c_b8ead52e24ec d3225c91_4858_fca4_72c5_c74a4f05f299["lowerContextAccess()"] d3225c91_4858_fca4_72c5_c74a4f05f299 -->|calls| c059451e_3ed5_62a9_6995_a4adbca6d62c 49446ae1_b830_9411_8258_1139d21b314b["createTemporaryPlace()"] c059451e_3ed5_62a9_6995_a4adbca6d62c -->|calls| 49446ae1_b830_9411_8258_1139d21b314b 11122e10_ce2f_5f61_cb70_9191695700a8["emitPropertyLoad()"] c059451e_3ed5_62a9_6995_a4adbca6d62c -->|calls| 11122e10_ce2f_5f61_cb70_9191695700a8 53244187_914c_cc90_5880_7bfc1fc9c0bb["push()"] c059451e_3ed5_62a9_6995_a4adbca6d62c -->|calls| 53244187_914c_cc90_5880_7bfc1fc9c0bb caf16ba5_f2da_dea5_5b0b_46526b9a25da["emitArrayInstr()"] c059451e_3ed5_62a9_6995_a4adbca6d62c -->|calls| caf16ba5_f2da_dea5_5b0b_46526b9a25da 0ed953ae_5345_6a11_8ecf_c387365fdf84["reversePostorderBlocks()"] c059451e_3ed5_62a9_6995_a4adbca6d62c -->|calls| 0ed953ae_5345_6a11_8ecf_c387365fdf84 0c09df5a_6c07_11e5_1a6b_9253007463b8["markInstructionIds()"] c059451e_3ed5_62a9_6995_a4adbca6d62c -->|calls| 0c09df5a_6c07_11e5_1a6b_9253007463b8 style c059451e_3ed5_62a9_6995_a4adbca6d62c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Optimization/LowerContextAccess.ts lines 219–291
function emitSelectorFn(env: Environment, keys: Array<string>): Instruction {
const obj: Place = createTemporaryPlace(env, GeneratedSource);
promoteTemporary(obj.identifier);
const instr: Array<Instruction> = [];
const elements = [];
for (const key of keys) {
const {instructions, element: prop} = emitPropertyLoad(env, obj, key);
instr.push(...instructions);
elements.push(prop);
}
const arrayInstr = emitArrayInstr(elements, env);
instr.push(arrayInstr);
const block: BasicBlock = {
kind: 'block',
id: makeBlockId(0),
instructions: instr,
terminal: {
id: makeInstructionId(0),
kind: 'return',
returnVariant: 'Explicit',
loc: GeneratedSource,
value: arrayInstr.lvalue,
effects: null,
},
preds: new Set(),
phis: new Set(),
};
const fn: HIRFunction = {
loc: GeneratedSource,
id: null,
nameHint: null,
fnType: 'Other',
env,
params: [obj],
returnTypeAnnotation: null,
returns: createTemporaryPlace(env, GeneratedSource),
context: [],
body: {
entry: block.id,
blocks: new Map([[block.id, block]]),
},
generator: false,
async: false,
directives: [],
aliasingEffects: [],
};
reversePostorderBlocks(fn.body);
markInstructionIds(fn.body);
enterSSA(fn);
inferTypes(fn);
const fnInstr: Instruction = {
id: makeInstructionId(0),
value: {
kind: 'FunctionExpression',
name: null,
nameHint: null,
loweredFunc: {
func: fn,
},
type: 'ArrowFunctionExpression',
loc: GeneratedSource,
},
lvalue: createTemporaryPlace(env, GeneratedSource),
effects: null,
loc: GeneratedSource,
};
return fnInstr;
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does emitSelectorFn() do?
emitSelectorFn() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/LowerContextAccess.ts.
Where is emitSelectorFn() defined?
emitSelectorFn() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/LowerContextAccess.ts at line 219.
What does emitSelectorFn() call?
emitSelectorFn() calls 6 function(s): createTemporaryPlace, emitArrayInstr, emitPropertyLoad, markInstructionIds, push, reversePostorderBlocks.
What calls emitSelectorFn()?
emitSelectorFn() is called by 1 function(s): lowerContextAccess.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free