Home / File/ visitors.ts — react Source File

visitors.ts — react Source File

Architecture documentation for visitors.ts, a typescript file in the react codebase. 18 imports, 46 dependents.

File typescript MIRInfrastructure HIR 18 imports 46 dependents 20 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"]
  eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> eb9d33f9_42c1_205c_93e6_8e1365a31839
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> d7fde76c_4fd9_feb3_299b_798689f05bc6
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 18a78965_f593_105b_e5e8_07001321c2ec
  5b3acd48_6f52_d332_a26f_b7cb0f74b86e["BasicBlock"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 5b3acd48_6f52_d332_a26f_b7cb0f74b86e
  4a73a9b9_07eb_502f_14c1_2f045ba2666c["BlockId"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 4a73a9b9_07eb_502f_14c1_2f045ba2666c
  02d16d8e_0a17_fa6f_eeef_ee0c7d25bd36["Instruction"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 02d16d8e_0a17_fa6f_eeef_ee0c7d25bd36
  03aa18e2_bd2c_e9cb_5973_bae3ec02373c["InstructionKind"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 03aa18e2_bd2c_e9cb_5973_bae3ec02373c
  b99c825f_2e15_fbd5_332e_fb1b900c8ca9["InstructionValue"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> b99c825f_2e15_fbd5_332e_fb1b900c8ca9
  d0270ab6_a621_bd55_a1b9_a5cad8b406b2["makeInstructionId"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> d0270ab6_a621_bd55_a1b9_a5cad8b406b2
  2495ee16_ccea_e0e9_848d_14b5f1d54f48["Pattern"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 2495ee16_ccea_e0e9_848d_14b5f1d54f48
  c7aaa235_c19e_3530_31c2_911f38eed3e0["Place"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> c7aaa235_c19e_3530_31c2_911f38eed3e0
  60e40c84_1324_6a2b_a7cf_f69d86f17579["ReactiveInstruction"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 60e40c84_1324_6a2b_a7cf_f69d86f17579
  ca9a6820_460e_0b15_8169_3aa4c6503770["ReactiveScope"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> ca9a6820_460e_0b15_8169_3aa4c6503770
  03931fe0_84fd_a4e9_b75a_03f9d092be95["ReactiveValue"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210 --> 03931fe0_84fd_a4e9_b75a_03f9d092be95
  style 2f3caf55_cc64_415c_55dd_9771ba7dc210 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 {assertExhaustive} from '../Utils/utils';
import {CompilerError} from '..';
import {
  BasicBlock,
  BlockId,
  Instruction,
  InstructionKind,
  InstructionValue,
  makeInstructionId,
  Pattern,
  Place,
  ReactiveInstruction,
  ReactiveScope,
  ReactiveValue,
  ScopeId,
  SpreadPattern,
  Terminal,
} from './HIR';

export function* eachInstructionLValue(
  instr: ReactiveInstruction,
): Iterable<Place> {
  if (instr.lvalue !== null) {
    yield instr.lvalue;
  }
  yield* eachInstructionValueLValue(instr.value);
}

export function* eachInstructionLValueWithKind(
  instr: ReactiveInstruction,
): Iterable<[Place, InstructionKind]> {
  switch (instr.value.kind) {
    case 'DeclareContext':
    case 'StoreContext':
    case 'DeclareLocal':
    case 'StoreLocal': {
      yield [instr.value.lvalue.place, instr.value.lvalue.kind];
      break;
    }
    case 'Destructure': {
      const kind = instr.value.lvalue.kind;
      for (const place of eachPatternOperand(instr.value.lvalue.pattern)) {
        yield [place, kind];
      }
      break;
    }
    case 'PostfixUpdate':
    case 'PrefixUpdate': {
      yield [instr.value.lvalue, InstructionKind.Reassign];
      break;
    }
  }
}
// ... (1251 more lines)

Subdomains

Imported By

Frequently Asked Questions

What does visitors.ts do?
visitors.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 visitors.ts?
visitors.ts defines 20 function(s): doesPatternContainSpreadElement, eachCallArgument, eachInstructionLValue, eachInstructionLValueWithKind, eachInstructionOperand, eachInstructionValueLValue, eachInstructionValueOperand, eachPatternItem, eachPatternOperand, eachTerminalOperand, and 10 more.
What does visitors.ts depend on?
visitors.ts imports 18 module(s): .., BasicBlock, BlockId, HIR.ts, Instruction, InstructionKind, InstructionValue, Pattern, and 10 more.
What files import visitors.ts?
visitors.ts is imported by 46 file(s): AlignObjectMethodScopes.ts, AlignReactiveScopesToBlockScopesHIR.ts, AssertConsistentIdentifiers.ts, AssertTerminalBlocksExist.ts, AssertValidBlockNesting.ts, AssertValidMutableRanges.ts, CodegenReactiveFunction.ts, DeadCodeElimination.ts, and 38 more.
Where is visitors.ts in the architecture?
visitors.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.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