Home / File/ DropManualMemoization.ts — react Source File

DropManualMemoization.ts — react Source File

Architecture documentation for DropManualMemoization.ts, a typescript file in the react codebase. 9 imports, 1 dependents.

File typescript BabelCompiler Validation 9 imports 1 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  4b3f307b_2e5b_6c5a_0729_065bd25db103["DropManualMemoization.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> e96f281e_f381_272d_2359_3e6a091c9a1d
  a2b91621_58d3_1d04_4663_00cd808f1034["ErrorCategory"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> a2b91621_58d3_1d04_4663_00cd808f1034
  0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> 0423f759_97e0_9101_4634_ed555abc5ca9
  df6865e0_b573_e905_84d6_4eb6b419a888["HIRBuilder.ts"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> df6865e0_b573_e905_84d6_4eb6b419a888
  49446ae1_b830_9411_8258_1139d21b314b["createTemporaryPlace"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> 49446ae1_b830_9411_8258_1139d21b314b
  0c09df5a_6c07_11e5_1a6b_9253007463b8["markInstructionIds"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> 0c09df5a_6c07_11e5_1a6b_9253007463b8
  494e3425_0b47_293a_1ea4_d4670b0fc0e7["Result.ts"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> 494e3425_0b47_293a_1ea4_d4670b0fc0e7
  7aace723_0ee1_cff5_b263_aec8e06dd79e["Result"]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> 7aace723_0ee1_cff5_b263_aec8e06dd79e
  2ed45bcd_6c82_3ccd_0e20_fa96b5111055[".."]
  4b3f307b_2e5b_6c5a_0729_065bd25db103 --> 2ed45bcd_6c82_3ccd_0e20_fa96b5111055
  24b95621_3482_c406_4b63_5b9d9e94b5af["ValidatePreservedManualMemoization.ts"]
  24b95621_3482_c406_4b63_5b9d9e94b5af --> 4b3f307b_2e5b_6c5a_0729_065bd25db103
  style 4b3f307b_2e5b_6c5a_0729_065bd25db103 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import {CompilerDiagnostic, CompilerError, SourceLocation} from '..';
import {ErrorCategory} from '../CompilerError';
import {
  CallExpression,
  Effect,
  Environment,
  FinishMemoize,
  FunctionExpression,
  HIRFunction,
  IdentifierId,
  Instruction,
  InstructionId,
  InstructionValue,
  LoadGlobal,
  LoadLocal,
  ManualMemoDependency,
  MethodCall,
  Place,
  PropertyLoad,
  SpreadPattern,
  StartMemoize,
  TInstruction,
  getHookKindForType,
  makeInstructionId,
} from '../HIR';
import {createTemporaryPlace, markInstructionIds} from '../HIR/HIRBuilder';
import {Result} from '../Utils/Result';

type ManualMemoCallee = {
  kind: 'useMemo' | 'useCallback';
  loadInstr: TInstruction<LoadGlobal> | TInstruction<PropertyLoad>;
};

type IdentifierSidemap = {
  functions: Map<IdentifierId, TInstruction<FunctionExpression>>;
  manualMemos: Map<IdentifierId, ManualMemoCallee>;
  react: Set<IdentifierId>;
  maybeDepsLists: Map<IdentifierId, {loc: SourceLocation; deps: Array<Place>}>;
  maybeDeps: Map<IdentifierId, ManualMemoDependency>;
  optionals: Set<IdentifierId>;
};

/**
 * Collect loads from named variables and property reads from @value
 * into `maybeDeps`
 * Returns the variable + property reads represented by @instr
 */
export function collectMaybeMemoDependencies(
  value: InstructionValue,
  maybeDeps: Map<IdentifierId, ManualMemoDependency>,
  optional: boolean,
): ManualMemoDependency | null {
  switch (value.kind) {
// ... (543 more lines)

Domain

Subdomains

Frequently Asked Questions

What does DropManualMemoization.ts do?
DropManualMemoization.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in DropManualMemoization.ts?
DropManualMemoization.ts defines 7 function(s): collectMaybeMemoDependencies, collectTemporaries, dropManualMemoization, extractManualMemoizationArgs, findOptionalPlaces, getManualMemoizationReplacement, makeManualMemoizationMarkers.
What does DropManualMemoization.ts depend on?
DropManualMemoization.ts imports 9 module(s): .., CompilerError.ts, ErrorCategory, HIRBuilder.ts, Result, Result.ts, createTemporaryPlace, index.ts, and 1 more.
What files import DropManualMemoization.ts?
DropManualMemoization.ts is imported by 1 file(s): ValidatePreservedManualMemoization.ts.
Where is DropManualMemoization.ts in the architecture?
DropManualMemoization.ts is located at compiler/packages/babel-plugin-react-compiler/src/Inference/DropManualMemoization.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/babel-plugin-react-compiler/src/Inference).

Analyze Your Own Codebase

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

Try Supermodel Free