Home / File/ HIR.ts — react Source File

HIR.ts — react Source File

Architecture documentation for HIR.ts, a typescript file in the react codebase. 23 imports, 47 dependents.

File typescript MIRInfrastructure HIR 23 imports 47 dependents 64 functions

Entity Profile

Dependency Diagram

graph LR
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> e96f281e_f381_272d_2359_3e6a091c9a1d
  0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042["CompilerDiagnostic"]
  18a78965_f593_105b_e5e8_07001321c2ec --> 0fda7f86_b7a3_c1f2_f0d9_8d13eed4f042
  e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"]
  18a78965_f593_105b_e5e8_07001321c2ec --> e51fd0d2_bb38_cc97_7763_efe37f300a47
  a2b91621_58d3_1d04_4663_00cd808f1034["ErrorCategory"]
  18a78965_f593_105b_e5e8_07001321c2ec --> a2b91621_58d3_1d04_4663_00cd808f1034
  eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> eb9d33f9_42c1_205c_93e6_8e1365a31839
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive"]
  18a78965_f593_105b_e5e8_07001321c2ec --> d7fde76c_4fd9_feb3_299b_798689f05bc6
  1b971013_8a90_0d8d_1fcc_f31581cd66aa["Environment.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> 1b971013_8a90_0d8d_1fcc_f31581cd66aa
  cba0c8a2_0db5_48e2_0d19_b2c6a46799e8["Environment"]
  18a78965_f593_105b_e5e8_07001321c2ec --> cba0c8a2_0db5_48e2_0d19_b2c6a46799e8
  3d4f48f2_0491_af90_7077_5573865bf9da["ReactFunctionType"]
  18a78965_f593_105b_e5e8_07001321c2ec --> 3d4f48f2_0491_af90_7077_5573865bf9da
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> 58f81300_7c82_5086_3e10_e46b5f3ab04d
  f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec["Types.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> f1874e3c_f8f2_5f68_d3a9_0c56c0dad5ec
  6700f63d_bcbd_1a9f_8cd9_05e34a927b23["Type"]
  18a78965_f593_105b_e5e8_07001321c2ec --> 6700f63d_bcbd_1a9f_8cd9_05e34a927b23
  c50e6c61_a100_0e6f_983b_951164ba4856["makeType"]
  18a78965_f593_105b_e5e8_07001321c2ec --> c50e6c61_a100_0e6f_983b_951164ba4856
  2f00e901_2271_5b46_4d72_3fa77ff15e31["AliasingEffects.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  style 18a78965_f593_105b_e5e8_07001321c2ec 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 {BindingKind} from '@babel/traverse';
import * as t from '@babel/types';
import {
  CompilerDiagnostic,
  CompilerError,
  ErrorCategory,
} from '../CompilerError';
import {assertExhaustive} from '../Utils/utils';
import {Environment, ReactFunctionType} from './Environment';
import type {HookKind} from './ObjectShape';
import {Type, makeType} from './Types';
import {z} from 'zod/v4';
import type {AliasingEffect} from '../Inference/AliasingEffects';
import {isReservedWord} from '../Utils/Keyword';
import {Err, Ok, Result} from '../Utils/Result';

/*
 * *******************************************************************************************
 * *******************************************************************************************
 * ************************************* Core Data Model *************************************
 * *******************************************************************************************
 * *******************************************************************************************
 */

// AST -> (lowering) -> HIR -> (analysis) -> Reactive Scopes -> (codegen) -> AST

/*
 * A location in a source file, intended to be used for providing diagnostic information and
 * transforming code while preserving source information (ie to emit source maps).
 *
 * `GeneratedSource` indicates that there is no single source location from which the code derives.
 */
export const GeneratedSource = Symbol();
export type SourceLocation = t.SourceLocation | typeof GeneratedSource;

/*
 * A React function defines a computation that takes some set of reactive inputs
 * (props, hook arguments) and return a result (JSX, hook return value). Unlike
 * HIR, the data model is tree-shaped:
 *
 * ReactFunction
 *    ReactiveBlock
 *      ReactiveBlockScope*
 *       Place* (dependencies)
 *       (ReactiveInstruction | ReactiveTerminal)*
 *
 * Where ReactiveTerminal may recursively contain zero or more ReactiveBlocks.
 *
 * Each ReactiveBlockScope describes a set of dependencies as well as the instructions (and terminals)
 * within that scope.
 */
export type ReactiveFunction = {
  loc: SourceLocation;
// ... (1940 more lines)

Subdomains

Types

Imported By

Frequently Asked Questions

What does HIR.ts do?
HIR.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 HIR.ts?
HIR.ts defines 64 function(s): _staticInvariantInstructionValueHasLocation, _staticInvariantReactiveTerminalHasInstructionId, _staticInvariantReactiveTerminalHasLocation, _staticInvariantTerminalHasFallthrough, _staticInvariantTerminalHasInstructionId, _staticInvariantTerminalHasLocation, areEqualPaths, convertHoistedLValueKind, evaluatesToStableTypeOrContainer, forkTemporaryIdentifier, and 54 more.
What does HIR.ts depend on?
HIR.ts imports 23 module(s): AliasingEffects.ts, CompilerDiagnostic, CompilerError, CompilerError.ts, Environment, Environment.ts, Err, ErrorCategory, and 15 more.
What files import HIR.ts?
HIR.ts is imported by 47 file(s): AlignReactiveScopesToBlockScopesHIR.ts, AssertConsistentIdentifiers.ts, AssertScopeInstructionsWithinScope.ts, AssertTerminalBlocksExist.ts, AssertValidBlockNesting.ts, AssertValidMutableRanges.ts, BuildHIR.ts, BuildReactiveFunction.ts, and 39 more.
Where is HIR.ts in the architecture?
HIR.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.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