InferReactivePlaces.ts — react Source File
Architecture documentation for InferReactivePlaces.ts, a typescript file in the react codebase. 16 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 725143dd_a713_5e8e_fdf0_9c99de3b528f["InferReactivePlaces.ts"] 0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> 0423f759_97e0_9101_4634_ed555abc5ca9 2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> 2f3caf55_cc64_415c_55dd_9771ba7dc210 10043bf1_f7ee_9ed9_307a_fe3edfd02b09["eachInstructionLValue"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> 10043bf1_f7ee_9ed9_307a_fe3edfd02b09 ccace1c3_85b7_a05e_c2a5_7eff8b3422ed["eachInstructionOperand"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> ccace1c3_85b7_a05e_c2a5_7eff8b3422ed b2fc2985_a7ba_9865_c2a3_2a7531f27d44["eachInstructionValueOperand"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> b2fc2985_a7ba_9865_c2a3_2a7531f27d44 41232a25_deb6_6e83_05a8_ae9f961656f7["eachTerminalOperand"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> 41232a25_deb6_6e83_05a8_ae9f961656f7 f041318d_301f_daad_4198_91d141b3039d["InferReactiveScopeVariables.ts"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> f041318d_301f_daad_4198_91d141b3039d b474edef_a60d_b132_2ae0_98f6768ec241["findDisjointMutableValues"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> b474edef_a60d_b132_2ae0_98f6768ec241 11746e9a_2fdf_98bb_bb3c_a63d8b200df2["isMutable"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> 11746e9a_2fdf_98bb_bb3c_a63d8b200df2 edec7689_7b1d_03c9_9cbb_bb9b0552bc30["DisjointSet.ts"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> edec7689_7b1d_03c9_9cbb_bb9b0552bc30 1765a682_3028_4441_b26f_c712ca2597d5["DisjointSet"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> 1765a682_3028_4441_b26f_c712ca2597d5 eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> eb9d33f9_42c1_205c_93e6_8e1365a31839 d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> d7fde76c_4fd9_feb3_299b_798689f05bc6 5d62162e_5fa5_1488_29bf_5150b4be53a0["ControlDominators.ts"] 725143dd_a713_5e8e_fdf0_9c99de3b528f --> 5d62162e_5fa5_1488_29bf_5150b4be53a0 style 725143dd_a713_5e8e_fdf0_9c99de3b528f 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} from '..';
import {
Effect,
Environment,
HIRFunction,
Identifier,
IdentifierId,
Instruction,
Place,
evaluatesToStableTypeOrContainer,
getHookKind,
isStableType,
isStableTypeContainer,
isUseOperator,
} from '../HIR';
import {
eachInstructionLValue,
eachInstructionOperand,
eachInstructionValueOperand,
eachTerminalOperand,
} from '../HIR/visitors';
import {
findDisjointMutableValues,
isMutable,
} from '../ReactiveScopes/InferReactiveScopeVariables';
import DisjointSet from '../Utils/DisjointSet';
import {assertExhaustive} from '../Utils/utils';
import {createControlDominators} from './ControlDominators';
/**
* Side map to track and propagate sources of stability (i.e. hook calls such as
* `useRef()` and property reads such as `useState()[1]). Note that this
* requires forward data flow analysis since stability is not part of React
* Compiler's type system.
*/
class StableSidemap {
map: Map<IdentifierId, {isStable: boolean}> = new Map();
env: Environment;
constructor(env: Environment) {
this.env = env;
}
handleInstruction(instr: Instruction): void {
const {value, lvalue} = instr;
switch (value.kind) {
case 'CallExpression':
case 'MethodCall': {
/**
* Sources of stability are known hook calls
*/
if (evaluatesToStableTypeOrContainer(this.env, instr)) {
// ... (354 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
Source
Frequently Asked Questions
What does InferReactivePlaces.ts do?
InferReactivePlaces.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 InferReactivePlaces.ts?
InferReactivePlaces.ts defines 1 function(s): inferReactivePlaces.
What does InferReactivePlaces.ts depend on?
InferReactivePlaces.ts imports 16 module(s): .., ControlDominators.ts, DisjointSet, DisjointSet.ts, InferReactiveScopeVariables.ts, assertExhaustive, createControlDominators, eachInstructionLValue, and 8 more.
Where is InferReactivePlaces.ts in the architecture?
InferReactivePlaces.ts is located at compiler/packages/babel-plugin-react-compiler/src/Inference/InferReactivePlaces.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