mayAllocate() — react Function Reference
Architecture documentation for the mayAllocate() function in InferReactiveScopeVariables.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 25afae47_3217_0d09_3179_995552e8b339["mayAllocate()"] f041318d_301f_daad_4198_91d141b3039d["InferReactiveScopeVariables.ts"] 25afae47_3217_0d09_3179_995552e8b339 -->|defined in| f041318d_301f_daad_4198_91d141b3039d b474edef_a60d_b132_2ae0_98f6768ec241["findDisjointMutableValues()"] b474edef_a60d_b132_2ae0_98f6768ec241 -->|calls| 25afae47_3217_0d09_3179_995552e8b339 f4ce4a75_9bb6_f3be_c3c6_eb60cb87ce0e["doesPatternContainSpreadElement()"] 25afae47_3217_0d09_3179_995552e8b339 -->|calls| f4ce4a75_9bb6_f3be_c3c6_eb60cb87ce0e d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"] 25afae47_3217_0d09_3179_995552e8b339 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6 style 25afae47_3217_0d09_3179_995552e8b339 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/InferReactiveScopeVariables.ts lines 209–270
function mayAllocate(_env: Environment, instruction: Instruction): boolean {
const {value} = instruction;
switch (value.kind) {
case 'Destructure': {
return doesPatternContainSpreadElement(value.lvalue.pattern);
}
case 'PostfixUpdate':
case 'PrefixUpdate':
case 'Await':
case 'DeclareLocal':
case 'DeclareContext':
case 'StoreLocal':
case 'LoadGlobal':
case 'MetaProperty':
case 'TypeCastExpression':
case 'LoadLocal':
case 'LoadContext':
case 'StoreContext':
case 'PropertyDelete':
case 'ComputedLoad':
case 'ComputedDelete':
case 'JSXText':
case 'TemplateLiteral':
case 'Primitive':
case 'GetIterator':
case 'IteratorNext':
case 'NextPropertyOf':
case 'Debugger':
case 'StartMemoize':
case 'FinishMemoize':
case 'UnaryExpression':
case 'BinaryExpression':
case 'PropertyLoad':
case 'StoreGlobal': {
return false;
}
case 'TaggedTemplateExpression':
case 'CallExpression':
case 'MethodCall': {
return instruction.lvalue.identifier.type.kind !== 'Primitive';
}
case 'RegExpLiteral':
case 'PropertyStore':
case 'ComputedStore':
case 'ArrayExpression':
case 'JsxExpression':
case 'JsxFragment':
case 'NewExpression':
case 'ObjectExpression':
case 'UnsupportedNode':
case 'ObjectMethod':
case 'FunctionExpression': {
return true;
}
default: {
assertExhaustive(
value,
`Unexpected value kind \`${(value as any).kind}\``,
);
}
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does mayAllocate() do?
mayAllocate() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/InferReactiveScopeVariables.ts.
Where is mayAllocate() defined?
mayAllocate() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/InferReactiveScopeVariables.ts at line 209.
What does mayAllocate() call?
mayAllocate() calls 2 function(s): assertExhaustive, doesPatternContainSpreadElement.
What calls mayAllocate()?
mayAllocate() is called by 1 function(s): findDisjointMutableValues.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free