Home / File/ InferMutationAliasingRanges.ts — react Source File

InferMutationAliasingRanges.ts — react Source File

Architecture documentation for InferMutationAliasingRanges.ts, a typescript file in the react codebase. 28 imports, 2 dependents.

File typescript BabelCompiler Validation 28 imports 2 dependents 2 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  99c95040_9e14_265b_aae3_b58b12a70d8d["InferMutationAliasingRanges.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 18a78965_f593_105b_e5e8_07001321c2ec
  4a73a9b9_07eb_502f_14c1_2f045ba2666c["BlockId"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 4a73a9b9_07eb_502f_14c1_2f045ba2666c
  60d25db4_8803_db04_13e8_2251272ec589["Effect"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 60d25db4_8803_db04_13e8_2251272ec589
  9241c5c1_a9a7_17bc_e41c_e967225008dd["HIRFunction"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 9241c5c1_a9a7_17bc_e41c_e967225008dd
  bd003dbd_e691_524b_0cf4_50e080ffea94["Identifier"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> bd003dbd_e691_524b_0cf4_50e080ffea94
  e3a6ca26_1f1a_c7f8_fbf3_804737192775["IdentifierId"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> e3a6ca26_1f1a_c7f8_fbf3_804737192775
  23767d65_9554_fcd2_f2aa_7de7634389f9["InstructionId"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 23767d65_9554_fcd2_f2aa_7de7634389f9
  dcf0dbc5_68f1_cb22_5136_9fa2db94d282["isJsxType"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> dcf0dbc5_68f1_cb22_5136_9fa2db94d282
  d0270ab6_a621_bd55_a1b9_a5cad8b406b2["makeInstructionId"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> d0270ab6_a621_bd55_a1b9_a5cad8b406b2
  a8d38e41_1012_9d92_b0d6_e81250fede26["ValueKind"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> a8d38e41_1012_9d92_b0d6_e81250fede26
  358e8ce3_19a4_3e01_1d6a_85100cffaccd["ValueReason"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 358e8ce3_19a4_3e01_1d6a_85100cffaccd
  c7aaa235_c19e_3530_31c2_911f38eed3e0["Place"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> c7aaa235_c19e_3530_31c2_911f38eed3e0
  85046cfe_6315_ef8a_3c37_15f5a0fd2b46["isPrimitiveType"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 85046cfe_6315_ef8a_3c37_15f5a0fd2b46
  2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"]
  99c95040_9e14_265b_aae3_b58b12a70d8d --> 2f3caf55_cc64_415c_55dd_9771ba7dc210
  style 99c95040_9e14_265b_aae3_b58b12a70d8d 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 {CompilerError, SourceLocation} from '..';
import {
  BlockId,
  Effect,
  HIRFunction,
  Identifier,
  IdentifierId,
  InstructionId,
  isJsxType,
  makeInstructionId,
  ValueKind,
  ValueReason,
  Place,
  isPrimitiveType,
} from '../HIR/HIR';
import {
  eachInstructionLValue,
  eachInstructionValueOperand,
  eachTerminalOperand,
} from '../HIR/visitors';
import {assertExhaustive, getOrInsertWith} from '../Utils/utils';
import {Err, Ok, Result} from '../Utils/Result';
import {AliasingEffect, MutationReason} from './AliasingEffects';

/**
 * This pass builds an abstract model of the heap and interprets the effects of the
 * given function in order to determine the following:
 * - The mutable ranges of all identifiers in the function
 * - The externally-visible effects of the function, such as mutations of params and
 *   context-vars, aliasing between params/context-vars/return-value, and impure side
 *   effects.
 * - The legacy `Effect` to store on each Place.
 *
 * This pass builds a data flow graph using the effects, tracking an abstract notion
 * of "when" each effect occurs relative to the others. It then walks each mutation
 * effect against the graph, updating the range of each node that would be reachable
 * at the "time" that the effect occurred.
 *
 * This pass also validates against invalid effects: any function that is reachable
 * by being called, or via a Render effect, is validated against mutating globals
 * or calling impure code.
 *
 * Note that this function also populates the outer function's aliasing effects with
 * any mutations that apply to its params or context variables.
 *
 * ## Example
 * A function expression such as the following:
 *
 * ```
 * (x) => { x.y = true }
 * ```
 *
 * Would populate a `Mutate x` aliasing effect on the outer function.
// ... (780 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does InferMutationAliasingRanges.ts do?
InferMutationAliasingRanges.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 InferMutationAliasingRanges.ts?
InferMutationAliasingRanges.ts defines 2 function(s): appendFunctionErrors, inferMutationAliasingRanges.
What does InferMutationAliasingRanges.ts depend on?
InferMutationAliasingRanges.ts imports 28 module(s): .., AliasingEffect, AliasingEffects.ts, BlockId, Effect, Err, HIR.ts, HIRFunction, and 20 more.
What files import InferMutationAliasingRanges.ts?
InferMutationAliasingRanges.ts is imported by 2 file(s): AnalyseFunctions.ts, Pipeline.ts.
Where is InferMutationAliasingRanges.ts in the architecture?
InferMutationAliasingRanges.ts is located at compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingRanges.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