Home / File/ visitors.ts — react Source File

visitors.ts — react Source File

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

File typescript BabelCompiler Validation 19 imports 21 dependents 3 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  21609915_b03a_fd75_b58a_4cb86ef9315b["visitors.ts"]
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 18a78965_f593_105b_e5e8_07001321c2ec
  9241c5c1_a9a7_17bc_e41c_e967225008dd["HIRFunction"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 9241c5c1_a9a7_17bc_e41c_e967225008dd
  23767d65_9554_fcd2_f2aa_7de7634389f9["InstructionId"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 23767d65_9554_fcd2_f2aa_7de7634389f9
  c7aaa235_c19e_3530_31c2_911f38eed3e0["Place"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> c7aaa235_c19e_3530_31c2_911f38eed3e0
  02f69dfe_af02_6deb_8891_1b0229142fd1["PrunedReactiveScopeBlock"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 02f69dfe_af02_6deb_8891_1b0229142fd1
  548400ef_0d5c_3a1e_0c02_c3a80b0d17e4["ReactiveBlock"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 548400ef_0d5c_3a1e_0c02_c3a80b0d17e4
  c0555545_1ea3_9d37_62ad_521eafe2daa8["ReactiveFunction"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> c0555545_1ea3_9d37_62ad_521eafe2daa8
  60e40c84_1324_6a2b_a7cf_f69d86f17579["ReactiveInstruction"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 60e40c84_1324_6a2b_a7cf_f69d86f17579
  0fba6722_c385_0076_d75b_47ee3ff87ee3["ReactiveScopeBlock"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 0fba6722_c385_0076_d75b_47ee3ff87ee3
  d2571adf_c2aa_1e5e_5c56_f26810a3829e["ReactiveStatement"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> d2571adf_c2aa_1e5e_5c56_f26810a3829e
  4b88d9db_fbef_bf80_04be_63232e2e4dc0["ReactiveTerminal"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 4b88d9db_fbef_bf80_04be_63232e2e4dc0
  97848b70_4205_af8b_cc43_f635e9b08163["ReactiveTerminalStatement"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 97848b70_4205_af8b_cc43_f635e9b08163
  03931fe0_84fd_a4e9_b75a_03f9d092be95["ReactiveValue"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 03931fe0_84fd_a4e9_b75a_03f9d092be95
  2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"]
  21609915_b03a_fd75_b58a_4cb86ef9315b --> 2f3caf55_cc64_415c_55dd_9771ba7dc210
  style 21609915_b03a_fd75_b58a_4cb86ef9315b 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 {
  HIRFunction,
  InstructionId,
  Place,
  PrunedReactiveScopeBlock,
  ReactiveBlock,
  ReactiveFunction,
  ReactiveInstruction,
  ReactiveScopeBlock,
  ReactiveStatement,
  ReactiveTerminal,
  ReactiveTerminalStatement,
  ReactiveValue,
} from '../HIR/HIR';
import {
  eachInstructionLValue,
  eachInstructionValueOperand,
  eachTerminalOperand,
} from '../HIR/visitors';
import {assertExhaustive} from '../Utils/utils';

export function visitReactiveFunction<TState>(
  fn: ReactiveFunction,
  visitor: ReactiveFunctionVisitor<TState>,
  state: TState,
): void {
  visitor.visitBlock(fn.body, state);
}

export class ReactiveFunctionVisitor<TState = void> {
  visitID(_id: InstructionId, _state: TState): void {}
  visitParam(_place: Place, _state: TState): void {}
  visitLValue(_id: InstructionId, _lvalue: Place, _state: TState): void {}
  visitPlace(_id: InstructionId, _place: Place, _state: TState): void {}
  visitReactiveFunctionValue(
    _id: InstructionId,
    _dependencies: Array<Place>,
    _fn: ReactiveFunction,
    _state: TState,
  ): void {}

  visitValue(id: InstructionId, value: ReactiveValue, state: TState): void {
    this.traverseValue(id, value, state);
  }
  traverseValue(id: InstructionId, value: ReactiveValue, state: TState): void {
    switch (value.kind) {
      case 'OptionalExpression': {
        this.visitValue(id, value.value, state);
        break;
      }
      case 'LogicalExpression': {
        this.visitValue(id, value.left, state);
        this.visitValue(id, value.right, state);
// ... (607 more lines)

Domain

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 BabelCompiler domain, Validation subdomain.
What functions are defined in visitors.ts?
visitors.ts defines 3 function(s): eachReactiveValueOperand, mapTerminalBlocks, visitReactiveFunction.
What does visitors.ts depend on?
visitors.ts imports 19 module(s): HIR.ts, HIRFunction, InstructionId, Place, PrunedReactiveScopeBlock, ReactiveBlock, ReactiveFunction, ReactiveInstruction, and 11 more.
What files import visitors.ts?
visitors.ts is imported by 21 file(s): AssertScopeInstructionsWithinScope.ts, AssertWellFormedBreakTargets.ts, CodegenReactiveFunction.ts, CollectReactiveIdentifiers.ts, CollectReferencedGlobals.ts, ExtractScopeDeclarationsFromDestructuring.ts, MergeReactiveScopesThatInvalidateTogether.ts, PromoteUsedTemporaries.ts, and 13 more.
Where is visitors.ts in the architecture?
visitors.ts is located at compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free