Home / Function/ recordDepsInValue() — react Function Reference

recordDepsInValue() — react Function Reference

Architecture documentation for the recordDepsInValue() function in ValidatePreservedManualMemoization.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  2430e594_74e0_ca9a_14be_251ff6fa4bb8["recordDepsInValue()"]
  310c2965_2897_08a7_588d_8109c9f88c0c["Visitor"]
  2430e594_74e0_ca9a_14be_251ff6fa4bb8 -->|defined in| 310c2965_2897_08a7_588d_8109c9f88c0c
  1d0d9ade_8ca6_4897_7d4a_358a8565f5b3["recordTemporaries()"]
  1d0d9ade_8ca6_4897_7d4a_358a8565f5b3 -->|calls| 2430e594_74e0_ca9a_14be_251ff6fa4bb8
  ad786783_79dc_d97c_fb6f_d2e1268b8fd5["visitInstruction()"]
  2430e594_74e0_ca9a_14be_251ff6fa4bb8 -->|calls| ad786783_79dc_d97c_fb6f_d2e1268b8fd5
  3bcb17a7_3310_8c3d_0a8d_2a7f62d66083["collectMaybeMemoDependencies()"]
  2430e594_74e0_ca9a_14be_251ff6fa4bb8 -->|calls| 3bcb17a7_3310_8c3d_0a8d_2a7f62d66083
  21b1eb1e_eaf5_5238_3a24_f56eb8ef7278["eachInstructionValueLValue()"]
  2430e594_74e0_ca9a_14be_251ff6fa4bb8 -->|calls| 21b1eb1e_eaf5_5238_3a24_f56eb8ef7278
  style 2430e594_74e0_ca9a_14be_251ff6fa4bb8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts lines 337–388

  recordDepsInValue(value: ReactiveValue, state: VisitorState): void {
    switch (value.kind) {
      case 'SequenceExpression': {
        for (const instr of value.instructions) {
          this.visitInstruction(instr, state);
        }
        this.recordDepsInValue(value.value, state);
        break;
      }
      case 'OptionalExpression': {
        this.recordDepsInValue(value.value, state);
        break;
      }
      case 'ConditionalExpression': {
        this.recordDepsInValue(value.test, state);
        this.recordDepsInValue(value.consequent, state);
        this.recordDepsInValue(value.alternate, state);
        break;
      }
      case 'LogicalExpression': {
        this.recordDepsInValue(value.left, state);
        this.recordDepsInValue(value.right, state);
        break;
      }
      default: {
        collectMaybeMemoDependencies(value, this.temporaries, false);
        if (
          value.kind === 'StoreLocal' ||
          value.kind === 'StoreContext' ||
          value.kind === 'Destructure'
        ) {
          for (const storeTarget of eachInstructionValueLValue(value)) {
            state.manualMemoState?.decls.add(
              storeTarget.identifier.declarationId,
            );
            if (storeTarget.identifier.name?.kind === 'named') {
              this.temporaries.set(storeTarget.identifier.id, {
                root: {
                  kind: 'NamedLocal',
                  value: storeTarget,
                  constant: false,
                },
                path: [],
                loc: storeTarget.loc,
              });
            }
          }
        }
        break;
      }
    }
  }

Domain

Subdomains

Frequently Asked Questions

What does recordDepsInValue() do?
recordDepsInValue() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts.
Where is recordDepsInValue() defined?
recordDepsInValue() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts at line 337.
What does recordDepsInValue() call?
recordDepsInValue() calls 3 function(s): collectMaybeMemoDependencies, eachInstructionValueLValue, visitInstruction.
What calls recordDepsInValue()?
recordDepsInValue() is called by 1 function(s): recordTemporaries.

Analyze Your Own Codebase

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

Try Supermodel Free