CollectOptionalChainDependencies.ts — react Source File
Architecture documentation for CollectOptionalChainDependencies.ts, a typescript file in the react codebase. 22 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR fd3023fa_cdd5_e8f0_669a_c459a0f89746["CollectOptionalChainDependencies.ts"] 53e05ed1_ffb1_8db2_8573_ef5a3fb99c72["CollectHoistablePropertyLoads.ts"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 7cd776c7_0283_e0eb_af1b_5474c371bd16["assertNonNull"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 7cd776c7_0283_e0eb_af1b_5474c371bd16 18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 18a78965_f593_105b_e5e8_07001321c2ec 4a73a9b9_07eb_502f_14c1_2f045ba2666c["BlockId"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 4a73a9b9_07eb_502f_14c1_2f045ba2666c 5b3acd48_6f52_d332_a26f_b7cb0f74b86e["BasicBlock"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 5b3acd48_6f52_d332_a26f_b7cb0f74b86e e3a6ca26_1f1a_c7f8_fbf3_804737192775["IdentifierId"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> e3a6ca26_1f1a_c7f8_fbf3_804737192775 67538878_fe95_51b1_23f8_f71e2575832c["ReactiveScopeDependency"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 67538878_fe95_51b1_23f8_f71e2575832c 4fed294b_13f9_fec0_cd63_966518547536["BranchTerminal"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 4fed294b_13f9_fec0_cd63_966518547536 f7ed5e1f_b141_870d_fb74_1bea77c0b771["TInstruction"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> f7ed5e1f_b141_870d_fb74_1bea77c0b771 b75afe4f_6bbc_65a5_6d95_d6b0a03a8899["PropertyLoad"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> b75afe4f_6bbc_65a5_6d95_d6b0a03a8899 eef97245_4baf_ba46_875d_0cd1028be439["StoreLocal"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> eef97245_4baf_ba46_875d_0cd1028be439 b520037e_e135_2bd9_f501_1fe9a8324ce5["GotoVariant"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> b520037e_e135_2bd9_f501_1fe9a8324ce5 f54cfbd9_c283_2686_dfc3_e1a59c5e4faa["TBasicBlock"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> f54cfbd9_c283_2686_dfc3_e1a59c5e4faa 6a8f174b_c954_4b2e_970d_cf116004dcc9["OptionalTerminal"] fd3023fa_cdd5_e8f0_669a_c459a0f89746 --> 6a8f174b_c954_4b2e_970d_cf116004dcc9 style fd3023fa_cdd5_e8f0_669a_c459a0f89746 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 {assertNonNull} from './CollectHoistablePropertyLoads';
import {
BlockId,
BasicBlock,
IdentifierId,
ReactiveScopeDependency,
BranchTerminal,
TInstruction,
PropertyLoad,
StoreLocal,
GotoVariant,
TBasicBlock,
OptionalTerminal,
HIRFunction,
DependencyPathEntry,
Instruction,
Terminal,
PropertyLiteral,
} from './HIR';
import {printIdentifier} from './PrintHIR';
export function collectOptionalChainSidemap(
fn: HIRFunction,
): OptionalChainSidemap {
const context: OptionalTraversalContext = {
currFn: fn,
blocks: fn.body.blocks,
seenOptionals: new Set(),
processedInstrsInOptional: new Set(),
temporariesReadInOptional: new Map(),
hoistableObjects: new Map(),
};
traverseFunction(fn, context);
return {
temporariesReadInOptional: context.temporariesReadInOptional,
processedInstrsInOptional: context.processedInstrsInOptional,
hoistableObjects: context.hoistableObjects,
};
}
export type OptionalChainSidemap = {
/**
* Stores the correct property mapping (e.g. `a?.b` instead of `a.b`) for
* dependency calculation. Note that we currently do not store anything on
* outer phi nodes.
*/
temporariesReadInOptional: ReadonlyMap<IdentifierId, ReactiveScopeDependency>;
/**
* Records instructions (PropertyLoads, StoreLocals, and test terminals)
* processed in this pass. When extracting dependencies in
* PropagateScopeDependencies, these instructions are skipped.
*
* E.g. given a?.b
// ... (353 more lines)
Domain
Subdomains
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does CollectOptionalChainDependencies.ts do?
CollectOptionalChainDependencies.ts is a source file in the react codebase, written in typescript. It belongs to the MIRInfrastructure domain, HIR subdomain.
What functions are defined in CollectOptionalChainDependencies.ts?
CollectOptionalChainDependencies.ts defines 4 function(s): collectOptionalChainSidemap, matchOptionalTestBlock, traverseFunction, traverseOptionalBlock.
What does CollectOptionalChainDependencies.ts depend on?
CollectOptionalChainDependencies.ts imports 22 module(s): .., BasicBlock, BlockId, BranchTerminal, CollectHoistablePropertyLoads.ts, DependencyPathEntry, GotoVariant, HIR.ts, and 14 more.
What files import CollectOptionalChainDependencies.ts?
CollectOptionalChainDependencies.ts is imported by 2 file(s): InferEffectDependencies.ts, PropagateScopeDependenciesHIR.ts.
Where is CollectOptionalChainDependencies.ts in the architecture?
CollectOptionalChainDependencies.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/CollectOptionalChainDependencies.ts (domain: MIRInfrastructure, subdomain: HIR, directory: compiler/packages/babel-plugin-react-compiler/src/HIR).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free