Home / File/ PrintHIR.ts — react Source File

PrintHIR.ts — react Source File

Architecture documentation for PrintHIR.ts, a typescript file in the react codebase. 14 imports, 19 dependents.

File typescript MIRInfrastructure HIR 14 imports 19 dependents 27 functions

Entity Profile

Dependency Diagram

graph LR
  6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"]
  e96f281e_f381_272d_2359_3e6a091c9a1d["CompilerError.ts"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> e96f281e_f381_272d_2359_3e6a091c9a1d
  e51fd0d2_bb38_cc97_7763_efe37f300a47["CompilerError"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> e51fd0d2_bb38_cc97_7763_efe37f300a47
  d77f9ffb_2d12_7d1f_126f_8c05214f0059["PrintReactiveFunction.ts"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> d77f9ffb_2d12_7d1f_126f_8c05214f0059
  694a6a07_b3ca_4ab4_beba_18f4053a49f2["printReactiveScopeSummary"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 694a6a07_b3ca_4ab4_beba_18f4053a49f2
  edec7689_7b1d_03c9_9cbb_bb9b0552bc30["DisjointSet.ts"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> edec7689_7b1d_03c9_9cbb_bb9b0552bc30
  1765a682_3028_4441_b26f_c712ca2597d5["DisjointSet"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 1765a682_3028_4441_b26f_c712ca2597d5
  eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> eb9d33f9_42c1_205c_93e6_8e1365a31839
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> d7fde76c_4fd9_feb3_299b_798689f05bc6
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 18a78965_f593_105b_e5e8_07001321c2ec
  b520037e_e135_2bd9_f501_1fe9a8324ce5["GotoVariant"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> b520037e_e135_2bd9_f501_1fe9a8324ce5
  03aa18e2_bd2c_e9cb_5973_bae3ec02373c["InstructionKind"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 03aa18e2_bd2c_e9cb_5973_bae3ec02373c
  2f00e901_2271_5b46_4d72_3fa77ff15e31["AliasingEffects.ts"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 2f00e901_2271_5b46_4d72_3fa77ff15e31
  9f54f993_76c3_b507_621f_ba4f24e13eda["AliasingEffect"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 9f54f993_76c3_b507_621f_ba4f24e13eda
  0609fbd1_bfa6_b02c_367b_23bb24b4c4ce["AliasingSignature"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd --> 0609fbd1_bfa6_b02c_367b_23bb24b4c4ce
  style 6976a9ee_9d8e_4f16_3016_495f39aff2fd 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 {printReactiveScopeSummary} from '../ReactiveScopes/PrintReactiveFunction';
import DisjointSet from '../Utils/DisjointSet';
import {assertExhaustive} from '../Utils/utils';
import type {
  FunctionExpression,
  HIR,
  HIRFunction,
  Identifier,
  IdentifierName,
  Instruction,
  InstructionValue,
  LValue,
  ManualMemoDependency,
  MutableRange,
  ObjectMethod,
  ObjectPropertyKey,
  Pattern,
  Phi,
  Place,
  ReactiveInstruction,
  ReactiveScope,
  ReactiveValue,
  SourceLocation,
  SpreadPattern,
  Terminal,
  Type,
} from './HIR';
import {GotoVariant, InstructionKind} from './HIR';
import {AliasingEffect, AliasingSignature} from '../Inference/AliasingEffects';

export type Options = {
  indent: number;
};

export function printFunctionWithOutlined(fn: HIRFunction): string {
  const output = [printFunction(fn)];
  for (const outlined of fn.env.getOutlinedFunctions()) {
    output.push(`\nfunction ${outlined.fn.id}:\n${printHIR(outlined.fn.body)}`);
  }
  return output.join('\n');
}

export function printFunction(fn: HIRFunction): string {
  const output = [];
  let definition = '';
  if (fn.id !== null) {
    definition += fn.id;
  } else {
    definition += '<<anonymous>>';
  }
  if (fn.nameHint != null) {
    definition += ` ${fn.nameHint}`;
// ... (977 more lines)

Subdomains

Types

Imported By

Frequently Asked Questions

What does PrintHIR.ts do?
PrintHIR.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 PrintHIR.ts?
PrintHIR.ts defines 27 function(s): getFunctionName, isMutable, printAliases, printAliasingEffect, printAliasingSignature, printFunction, printFunctionWithOutlined, printHIR, printHole, printIdentifier, and 17 more.
What does PrintHIR.ts depend on?
PrintHIR.ts imports 14 module(s): AliasingEffect, AliasingEffects.ts, AliasingSignature, CompilerError, CompilerError.ts, DisjointSet, DisjointSet.ts, GotoVariant, and 6 more.
What files import PrintHIR.ts?
PrintHIR.ts is imported by 19 file(s): AliasingEffects.ts, AssertConsistentIdentifiers.ts, AssertTerminalBlocksExist.ts, AssertValidMutableRanges.ts, CodegenReactiveFunction.ts, CollectOptionalChainDependencies.ts, DeriveMinimalDependenciesHIR.ts, EnterSSA.ts, and 11 more.
Where is PrintHIR.ts in the architecture?
PrintHIR.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.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