Home / File/ AliasingEffects.ts — react Source File

AliasingEffects.ts — react Source File

Architecture documentation for AliasingEffects.ts, a typescript file in the react codebase. 7 imports, 6 dependents.

File typescript BabelCompiler Validation 7 imports 6 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  2f00e901_2271_5b46_4d72_3fa77ff15e31["AliasingEffects.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  2f00e901_2271_5b46_4d72_3fa77ff15e31 --> e96f281e_f381_272d_2359_3e6a091c9a1d
  0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042["CompilerDiagnostic"]
  2f00e901_2271_5b46_4d72_3fa77ff15e31 --> 0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042
  0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"]
  2f00e901_2271_5b46_4d72_3fa77ff15e31 --> 0423f759_97e0_9101_4634_ed555abc5ca9
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  2f00e901_2271_5b46_4d72_3fa77ff15e31 --> 58f81300_7c82_5086_3e10_e46b5f3ab04d
  8518cb66_056b_e4aa_6ee1_ca8ccd215d4e["FunctionSignature"]
  2f00e901_2271_5b46_4d72_3fa77ff15e31 --> 8518cb66_056b_e4aa_6ee1_ca8ccd215d4e
  6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"]
  2f00e901_2271_5b46_4d72_3fa77ff15e31 --> 6976a9ee_9d8e_4f16_3016_495f39aff2fd
  f2599d2d_bbc8_cb5d_6bc8_f8d4601ee49e["printSourceLocation"]
  2f00e901_2271_5b46_4d72_3fa77ff15e31 --> f2599d2d_bbc8_cb5d_6bc8_f8d4601ee49e
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  58f81300_7c82_5086_3e10_e46b5f3ab04d --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  d24875c3_c045_4414_2cc9_16f96d59c629["InferMutationAliasingEffects.ts"]
  d24875c3_c045_4414_2cc9_16f96d59c629 --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  99c95040_9e14_265b_aae3_b58b12a70d8d["InferMutationAliasingRanges.ts"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  8ecac9ec_c10d_6d28_acad_1f65ff39ebfb["ValidateNoFreezingKnownMutableFunctions.ts"]
  8ecac9ec_c10d_6d28_acad_1f65ff39ebfb --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  style 2f00e901_2271_5b46_4d72_3fa77ff15e31 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} from '../CompilerError';
import {
  FunctionExpression,
  GeneratedSource,
  Hole,
  IdentifierId,
  ObjectMethod,
  Place,
  SourceLocation,
  SpreadPattern,
  ValueKind,
  ValueReason,
} from '../HIR';
import {FunctionSignature} from '../HIR/ObjectShape';
import {printSourceLocation} from '../HIR/PrintHIR';

/**
 * `AliasingEffect` describes a set of "effects" that an instruction/terminal has on one or
 * more values in a program. These effects include mutation of values, freezing values,
 * tracking data flow between values, and other specialized cases.
 */
export type AliasingEffect =
  /**
   * Marks the given value and its direct aliases as frozen.
   *
   * Captured values are *not* considered frozen, because we cannot be sure that a previously
   * captured value will still be captured at the point of the freeze.
   *
   * For example:
   * const x = {};
   * const y = [x];
   * y.pop(); // y dosn't contain x anymore!
   * freeze(y);
   * mutate(x); // safe to mutate!
   *
   * The exception to this is FunctionExpressions - since it is impossible to change which
   * value a function closes over[1] we can transitively freeze functions and their captures.
   *
   * [1] Except for `let` values that are reassigned and closed over by a function, but we
   * handle this explicitly with StoreContext/LoadContext.
   */
  | {kind: 'Freeze'; value: Place; reason: ValueReason}
  /**
   * Mutate the value and any direct aliases (not captures). Errors if the value is not mutable.
   */
  | {kind: 'Mutate'; value: Place; reason?: MutationReason | null}
  /**
   * Mutate the value and any direct aliases (not captures), but only if the value is known mutable.
   * This should be rare.
   *
   * TODO: this is only used for IteratorNext, but even then MutateTransitiveConditionally is more
   * correct for iterators of unknown types.
   */
// ... (205 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does AliasingEffects.ts do?
AliasingEffects.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 AliasingEffects.ts?
AliasingEffects.ts defines 1 function(s): hashEffect.
What does AliasingEffects.ts depend on?
AliasingEffects.ts imports 7 module(s): CompilerDiagnostic, CompilerError.ts, FunctionSignature, ObjectShape.ts, PrintHIR.ts, index.ts, printSourceLocation.
What files import AliasingEffects.ts?
AliasingEffects.ts is imported by 6 file(s): HIR.ts, InferMutationAliasingEffects.ts, InferMutationAliasingRanges.ts, ObjectShape.ts, PrintHIR.ts, ValidateNoFreezingKnownMutableFunctions.ts.
Where is AliasingEffects.ts in the architecture?
AliasingEffects.ts is located at compiler/packages/babel-plugin-react-compiler/src/Inference/AliasingEffects.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