Home / File/ HIRBuilder.ts — react Source File

HIRBuilder.ts — react Source File

Architecture documentation for HIRBuilder.ts, a typescript file in the react codebase. 32 imports, 16 dependents.

File typescript MIRInfrastructure HIR 32 imports 16 dependents 13 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  df6865e0_b573_e905_84d6_4eb6b419a888["HIRBuilder.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> e96f281e_f381_272d_2359_3e6a091c9a1d
  e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> e51fd0d2_bb38_cc97_7763_efe37f300a47
  a2b91621_58d3_1d04_4663_00cd808f1034["ErrorCategory"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> a2b91621_58d3_1d04_4663_00cd808f1034
  1b971013_8a90_0d8d_1fcc_f31581cd66aa["Environment.ts"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> 1b971013_8a90_0d8d_1fcc_f31581cd66aa
  cba0c8a2_0db5_48e2_0d19_b2c6a46799e8["Environment"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> cba0c8a2_0db5_48e2_0d19_b2c6a46799e8
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> 18a78965_f593_105b_e5e8_07001321c2ec
  5b3acd48_6f52_d332_a26f_b7cb0f74b86e["BasicBlock"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> 5b3acd48_6f52_d332_a26f_b7cb0f74b86e
  4a73a9b9_07eb_502f_14c1_2f045ba2666c["BlockId"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> 4a73a9b9_07eb_502f_14c1_2f045ba2666c
  6d3b4d74_96a1_efef_7a6e_a317708e8cb1["BlockKind"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> 6d3b4d74_96a1_efef_7a6e_a317708e8cb1
  60d25db4_8803_db04_13e8_2251272ec589["Effect"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> 60d25db4_8803_db04_13e8_2251272ec589
  b520037e_e135_2bd9_f501_1fe9a8324ce5["GotoVariant"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> b520037e_e135_2bd9_f501_1fe9a8324ce5
  84e61022_6608_cd44_18fd_5844dea02b4f["HIR"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> 84e61022_6608_cd44_18fd_5844dea02b4f
  bd003dbd_e691_524b_0cf4_50e080ffea94["Identifier"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> bd003dbd_e691_524b_0cf4_50e080ffea94
  e3a6ca26_1f1a_c7f8_fbf3_804737192775["IdentifierId"]
  df6865e0_b573_e905_84d6_4eb6b419a888 --> e3a6ca26_1f1a_c7f8_fbf3_804737192775
  style df6865e0_b573_e905_84d6_4eb6b419a888 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 {Binding, NodePath} from '@babel/traverse';
import * as t from '@babel/types';
import {CompilerError, ErrorCategory} from '../CompilerError';
import {Environment} from './Environment';
import {
  BasicBlock,
  BlockId,
  BlockKind,
  Effect,
  GeneratedSource,
  GotoVariant,
  HIR,
  Identifier,
  IdentifierId,
  Instruction,
  Place,
  SourceLocation,
  Terminal,
  VariableBinding,
  makeBlockId,
  makeDeclarationId,
  makeIdentifierName,
  makeInstructionId,
  makeTemporaryIdentifier,
  makeType,
} from './HIR';
import {printInstruction} from './PrintHIR';
import {
  eachTerminalSuccessor,
  mapTerminalSuccessors,
  terminalFallthrough,
} from './visitors';

/*
 * *******************************************************************************************
 * *******************************************************************************************
 * ************************************* Lowering to HIR *************************************
 * *******************************************************************************************
 * *******************************************************************************************
 */

// A work-in-progress block that does not yet have a terminator
export type WipBlock = {
  id: BlockId;
  instructions: Array<Instruction>;
  kind: BlockKind;
};

type Scope = LoopScope | LabelScope | SwitchScope;

type LoopScope = {
  kind: 'loop';
  label: string | null;
// ... (891 more lines)

Subdomains

Classes

Frequently Asked Questions

What does HIRBuilder.ts do?
HIRBuilder.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 HIRBuilder.ts?
HIRBuilder.ts defines 13 function(s): _shrink, clonePlaceToTemporary, createTemporaryPlace, fixScopeAndIdentifierRanges, getReversePostorderedBlocks, getTargetIfIndirection, markInstructionIds, markPredecessors, newBlock, removeDeadDoWhileStatements, and 3 more.
What does HIRBuilder.ts depend on?
HIRBuilder.ts imports 32 module(s): BasicBlock, BlockId, BlockKind, CompilerError, CompilerError.ts, Effect, Environment, Environment.ts, and 24 more.
What files import HIRBuilder.ts?
HIRBuilder.ts is imported by 16 file(s): BuildHIR.ts, BuildReactiveScopeTerminalsHIR.ts, ConstantPropagation.ts, DropManualMemoization.ts, ExtractScopeDeclarationsFromDestructuring.ts, InferEffectDependencies.ts, InferMutationAliasingEffects.ts, InlineImmediatelyInvokedFunctionExpressions.ts, and 8 more.
Where is HIRBuilder.ts in the architecture?
HIRBuilder.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.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