ValidatePreservedManualMemoization.ts — react Source File
Architecture documentation for ValidatePreservedManualMemoization.ts, a typescript file in the react codebase. 20 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 24b95621_3482_c406_4b63_5b9d9e94b5af["ValidatePreservedManualMemoization.ts"] e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> e96f281e_f381_272d_2359_3e6a091c9a1d 0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042["CompilerDiagnostic"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042 e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> e51fd0d2_bb38_cc97_7763_efe37f300a47 a2b91621_58d3_1d04_4663_00cd808f1034["ErrorCategory"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> a2b91621_58d3_1d04_4663_00cd808f1034 0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 0423f759_97e0_9101_4634_ed555abc5ca9 6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 6976a9ee_9d8e_4f16_3016_495f39aff2fd e7a01d7c_c128_be66_a07d_007952a380da["printIdentifier"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> e7a01d7c_c128_be66_a07d_007952a380da 7791fd4d_5296_2b3e_4771_a3069a4070ed["printManualMemoDependency"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 7791fd4d_5296_2b3e_4771_a3069a4070ed 2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 2f3caf55_cc64_415c_55dd_9771ba7dc210 21b1eb1e_eaf5_5238_3a24_f56eb8ef7278["eachInstructionValueLValue"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 21b1eb1e_eaf5_5238_3a24_f56eb8ef7278 b2fc2985_a7ba_9865_c2a3_2a7531f27d44["eachInstructionValueOperand"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> b2fc2985_a7ba_9865_c2a3_2a7531f27d44 4b3f307b_2e5b_6c5a_0729_065bd25db103["DropManualMemoization.ts"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 4b3f307b_2e5b_6c5a_0729_065bd25db103 3bcb17a7_3310_8c3d_0a8d_2a7f62d66083["collectMaybeMemoDependencies"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 3bcb17a7_3310_8c3d_0a8d_2a7f62d66083 21609915_b03a_fd75_b58a_4cb86ef9315b["visitors.ts"] 24b95621_3482_c406_4b63_5b9d9e94b5af --> 21609915_b03a_fd75_b58a_4cb86ef9315b style 24b95621_3482_c406_4b63_5b9d9e94b5af 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,
ErrorCategory,
} from '../CompilerError';
import {
DeclarationId,
Effect,
GeneratedSource,
Identifier,
IdentifierId,
InstructionValue,
ManualMemoDependency,
PrunedReactiveScopeBlock,
ReactiveFunction,
ReactiveInstruction,
ReactiveScopeBlock,
ReactiveScopeDependency,
ReactiveValue,
ScopeId,
SourceLocation,
} from '../HIR';
import {printIdentifier, printManualMemoDependency} from '../HIR/PrintHIR';
import {
eachInstructionValueLValue,
eachInstructionValueOperand,
} from '../HIR/visitors';
import {collectMaybeMemoDependencies} from '../Inference/DropManualMemoization';
import {
ReactiveFunctionVisitor,
visitReactiveFunction,
} from '../ReactiveScopes/visitors';
import {Result} from '../Utils/Result';
import {getOrInsertDefault} from '../Utils/utils';
/**
* Validates that all explicit manual memoization (useMemo/useCallback) was accurately
* preserved, and that no originally memoized values became unmemoized in the output.
*
* This can occur if a value's mutable range somehow extended to include a hook and
* was pruned.
*/
export function validatePreservedManualMemoization(
fn: ReactiveFunction,
): Result<void, CompilerError> {
const state = {
errors: new CompilerError(),
manualMemoState: null,
};
visitReactiveFunction(fn, new Visitor(), state);
return state.errors.asResult();
}
// ... (550 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- CompilerDiagnostic
- CompilerError
- CompilerError.ts
- DropManualMemoization.ts
- ErrorCategory
- PrintHIR.ts
- ReactiveFunctionVisitor
- Result
- Result.ts
- collectMaybeMemoDependencies
- eachInstructionValueLValue
- eachInstructionValueOperand
- getOrInsertDefault
- index.ts
- printIdentifier
- printManualMemoDependency
- utils.ts
- visitReactiveFunction
- visitors.ts
- visitors.ts
Source
Frequently Asked Questions
What does ValidatePreservedManualMemoization.ts do?
ValidatePreservedManualMemoization.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 ValidatePreservedManualMemoization.ts?
ValidatePreservedManualMemoization.ts defines 7 function(s): compareDeps, getCompareDependencyResultDescription, isUnmemoized, merge, prettyPrintScopeDependency, validateInferredDep, validatePreservedManualMemoization.
What does ValidatePreservedManualMemoization.ts depend on?
ValidatePreservedManualMemoization.ts imports 20 module(s): CompilerDiagnostic, CompilerError, CompilerError.ts, DropManualMemoization.ts, ErrorCategory, PrintHIR.ts, ReactiveFunctionVisitor, Result, and 12 more.
Where is ValidatePreservedManualMemoization.ts in the architecture?
ValidatePreservedManualMemoization.ts is located at compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/babel-plugin-react-compiler/src/Validation).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free