Home / File/ CollectHoistablePropertyLoads.ts — react Source File

CollectHoistablePropertyLoads.ts — react Source File

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

File typescript MIRInfrastructure HIR 28 imports 3 dependents 11 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72["CollectHoistablePropertyLoads.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> e96f281e_f381_272d_2359_3e6a091c9a1d
  e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> e51fd0d2_bb38_cc97_7763_efe37f300a47
  f041318d_301f_daad_4198_91d141b3039d["InferReactiveScopeVariables.ts"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> f041318d_301f_daad_4198_91d141b3039d
  77f6c8f4_9a10_4ed4_40d4_5d5f7009db30["inRange"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> 77f6c8f4_9a10_4ed4_40d4_5d5f7009db30
  d77f9ffb_2d12_7d1f_126f_8c05214f0059["PrintReactiveFunction.ts"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> d77f9ffb_2d12_7d1f_126f_8c05214f0059
  a41e1147_6bb8_6588_8639_f338115ead9b["printDependency"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> a41e1147_6bb8_6588_8639_f338115ead9b
  eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> eb9d33f9_42c1_205c_93e6_8e1365a31839
  e080dc7f_df5e_9e0a_7e03_47e871ebcf2f["Set_equal"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> e080dc7f_df5e_9e0a_7e03_47e871ebcf2f
  0c8c1a1b_48b7_ed11_7af0_b4cb1faadd61["Set_filter"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> 0c8c1a1b_48b7_ed11_7af0_b4cb1faadd61
  ee9b165b_0867_64d5_5519_91b3d1b0cee2["Set_intersect"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> ee9b165b_0867_64d5_5519_91b3d1b0cee2
  35f8cf61_5992_c8a3_811c_0cf8af25b023["Set_union"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> 35f8cf61_5992_c8a3_811c_0cf8af25b023
  14f2e51a_d755_814e_2f56_72d3ed119459["getOrInsertDefault"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> 14f2e51a_d755_814e_2f56_72d3ed119459
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> 18a78965_f593_105b_e5e8_07001321c2ec
  5b3acd48_6f52_d332_a26f_b7cb0f74b86e["BasicBlock"]
  53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 --> 5b3acd48_6f52_d332_a26f_b7cb0f74b86e
  style 53e05ed1_ffb1_8db2_8573_ef5a3fb99c72 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 '../CompilerError';
import {inRange} from '../ReactiveScopes/InferReactiveScopeVariables';
import {printDependency} from '../ReactiveScopes/PrintReactiveFunction';
import {
  Set_equal,
  Set_filter,
  Set_intersect,
  Set_union,
  getOrInsertDefault,
} from '../Utils/utils';
import {
  BasicBlock,
  BlockId,
  DependencyPathEntry,
  FunctionExpression,
  GeneratedSource,
  getHookKind,
  HIRFunction,
  Identifier,
  IdentifierId,
  InstructionId,
  InstructionValue,
  LoweredFunction,
  PropertyLiteral,
  ReactiveScopeDependency,
  ScopeId,
  TInstruction,
} from './HIR';

const DEBUG_PRINT = false;

/**
 * Helper function for `PropagateScopeDependencies`. Uses control flow graph
 * analysis to determine which `Identifier`s can be assumed to be non-null
 * objects, on a per-block basis.
 *
 * Here is an example:
 * ```js
 * function useFoo(x, y, z) {
 *   // NOT safe to hoist PropertyLoads here
 *   if (...) {
 *     // safe to hoist loads from x
 *     read(x.a);
 *     return;
 *   }
 *   // safe to hoist loads from y, z
 *   read(y.b);
 *   if (...) {
 *     // safe to hoist loads from y, z
 *     read(z.a);
 *   } else {
 *     // safe to hoist loads from y, z
 *     read(z.b);
// ... (751 more lines)

Subdomains

Frequently Asked Questions

What does CollectHoistablePropertyLoads.ts do?
CollectHoistablePropertyLoads.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 CollectHoistablePropertyLoads.ts?
CollectHoistablePropertyLoads.ts defines 11 function(s): assertNonNull, collectHoistablePropertyLoads, collectHoistablePropertyLoadsImpl, collectHoistablePropertyLoadsInInnerFn, collectNonNullsInBlocks, getAssumedInvokedFunctions, getMaybeNonNullInInstruction, isImmutableAtInstr, keyByScopeId, propagateNonNull, and 1 more.
What does CollectHoistablePropertyLoads.ts depend on?
CollectHoistablePropertyLoads.ts imports 28 module(s): BasicBlock, BlockId, CompilerError, CompilerError.ts, DependencyPathEntry, FunctionExpression, HIR.ts, HIRFunction, and 20 more.
What files import CollectHoistablePropertyLoads.ts?
CollectHoistablePropertyLoads.ts is imported by 3 file(s): CollectOptionalChainDependencies.ts, InferEffectDependencies.ts, PropagateScopeDependenciesHIR.ts.
Where is CollectHoistablePropertyLoads.ts in the architecture?
CollectHoistablePropertyLoads.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.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