Home / Function/ validateContextVariableLValuesImpl() — react Function Reference

validateContextVariableLValuesImpl() — react Function Reference

Architecture documentation for the validateContextVariableLValuesImpl() function in ValidateContextVariableLValues.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2["validateContextVariableLValuesImpl()"]
  e43116d7_42b9_7724_244c_9ae9f04a7964["ValidateContextVariableLValues.ts"]
  847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2 -->|defined in| e43116d7_42b9_7724_244c_9ae9f04a7964
  b8f6f62b_ef14_10e0_5ef5_a8da3d5e5b04["validateContextVariableLValues()"]
  b8f6f62b_ef14_10e0_5ef5_a8da3d5e5b04 -->|calls| 847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2
  76301bc6_90a4_2d71_66fe_eb01715d8f65["visit()"]
  847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2 -->|calls| 76301bc6_90a4_2d71_66fe_eb01715d8f65
  f5637d03_fd91_50b8_9da7_b2a24c91bab7["eachPatternOperand()"]
  847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  21b1eb1e_eaf5_5238_3a24_f56eb8ef7278["eachInstructionValueLValue()"]
  847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2 -->|calls| 21b1eb1e_eaf5_5238_3a24_f56eb8ef7278
  style 847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateContextVariableLValues.ts lines 23–82

function validateContextVariableLValuesImpl(
  fn: HIRFunction,
  identifierKinds: IdentifierKinds,
): void {
  for (const [, block] of fn.body.blocks) {
    for (const instr of block.instructions) {
      const {value} = instr;
      switch (value.kind) {
        case 'DeclareContext':
        case 'StoreContext': {
          visit(identifierKinds, value.lvalue.place, 'context');
          break;
        }
        case 'LoadContext': {
          visit(identifierKinds, value.place, 'context');
          break;
        }
        case 'StoreLocal':
        case 'DeclareLocal': {
          visit(identifierKinds, value.lvalue.place, 'local');
          break;
        }
        case 'LoadLocal': {
          visit(identifierKinds, value.place, 'local');
          break;
        }
        case 'PostfixUpdate':
        case 'PrefixUpdate': {
          visit(identifierKinds, value.lvalue, 'local');
          break;
        }
        case 'Destructure': {
          for (const lvalue of eachPatternOperand(value.lvalue.pattern)) {
            visit(identifierKinds, lvalue, 'destructure');
          }
          break;
        }
        case 'ObjectMethod':
        case 'FunctionExpression': {
          validateContextVariableLValuesImpl(
            value.loweredFunc.func,
            identifierKinds,
          );
          break;
        }
        default: {
          for (const _ of eachInstructionValueLValue(value)) {
            CompilerError.throwTodo({
              reason:
                'ValidateContextVariableLValues: unhandled instruction variant',
              loc: value.loc,
              description: `Handle '${value.kind} lvalues`,
              suggestions: null,
            });
          }
        }
      }
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does validateContextVariableLValuesImpl() do?
validateContextVariableLValuesImpl() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateContextVariableLValues.ts.
Where is validateContextVariableLValuesImpl() defined?
validateContextVariableLValuesImpl() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateContextVariableLValues.ts at line 23.
What does validateContextVariableLValuesImpl() call?
validateContextVariableLValuesImpl() calls 3 function(s): eachInstructionValueLValue, eachPatternOperand, visit.
What calls validateContextVariableLValuesImpl()?
validateContextVariableLValuesImpl() is called by 1 function(s): validateContextVariableLValues.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free