Home / File/ MemoizeFbtAndMacroOperandsInSameScope.ts — react Source File

MemoizeFbtAndMacroOperandsInSameScope.ts — react Source File

Architecture documentation for MemoizeFbtAndMacroOperandsInSameScope.ts, a typescript file in the react codebase. 5 imports, 1 dependents.

File typescript BabelCompiler Validation 5 imports 1 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  fb4e4a7f_2a4f_a45a_81e6_48b5748e5365["MemoizeFbtAndMacroOperandsInSameScope.ts"]
  0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"]
  fb4e4a7f_2a4f_a45a_81e6_48b5748e5365 --> 0423f759_97e0_9101_4634_ed555abc5ca9
  1b971013_8a90_0d8d_1fcc_f31581cd66aa["Environment.ts"]
  fb4e4a7f_2a4f_a45a_81e6_48b5748e5365 --> 1b971013_8a90_0d8d_1fcc_f31581cd66aa
  db0aa40a_69fe_0bae_b2ed_6848839dc387["Macro"]
  fb4e4a7f_2a4f_a45a_81e6_48b5748e5365 --> db0aa40a_69fe_0bae_b2ed_6848839dc387
  2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"]
  fb4e4a7f_2a4f_a45a_81e6_48b5748e5365 --> 2f3caf55_cc64_415c_55dd_9771ba7dc210
  b2fc2985_a7ba_9865_c2a3_2a7531f27d44["eachInstructionValueOperand"]
  fb4e4a7f_2a4f_a45a_81e6_48b5748e5365 --> b2fc2985_a7ba_9865_c2a3_2a7531f27d44
  dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"]
  dc7f10c2_c914_a162_d02b_a10a15c64a5f --> fb4e4a7f_2a4f_a45a_81e6_48b5748e5365
  style fb4e4a7f_2a4f_a45a_81e6_48b5748e5365 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,
  IdentifierId,
  InstructionValue,
  makeInstructionId,
  MutableRange,
  Place,
  ReactiveScope,
} from '../HIR';
import {Macro} from '../HIR/Environment';
import {eachInstructionValueOperand} from '../HIR/visitors';

/**
 * Whether a macro requires its arguments to be transitively inlined (eg fbt)
 * or just avoid having the top-level values be converted to variables (eg fbt.param)
 */
enum InlineLevel {
  Transitive = 'Transitive',
  Shallow = 'Shallow',
}
type MacroDefinition = {
  level: InlineLevel;
  properties: Map<string, MacroDefinition> | null;
};

const SHALLOW_MACRO: MacroDefinition = {
  level: InlineLevel.Shallow,
  properties: null,
};
const TRANSITIVE_MACRO: MacroDefinition = {
  level: InlineLevel.Transitive,
  properties: null,
};
const FBT_MACRO: MacroDefinition = {
  level: InlineLevel.Transitive,
  properties: new Map([['*', SHALLOW_MACRO]]),
};
FBT_MACRO.properties!.set('enum', FBT_MACRO);

/**
 * This pass supports the `fbt` translation system (https://facebook.github.io/fbt/)
 * as well as similar user-configurable macro-like APIs where it's important that
 * the name of the function not be changed, and it's literal arguments not be turned
 * into temporaries.
 *
 * ## FBT
 *
 * FBT provides the `<fbt>` JSX element and `fbt()` calls (which take params in the
 * form of `<fbt:param>` children or `fbt.param()` arguments, respectively). These
 * tags/functions have restrictions on what types of syntax may appear as props/children/
 * arguments, notably that variable references may not appear directly — variables
 * must always be wrapped in a `<fbt:param>` or `fbt.param()`.
 *
// ... (245 more lines)

Domain

Subdomains

Frequently Asked Questions

What does MemoizeFbtAndMacroOperandsInSameScope.ts do?
MemoizeFbtAndMacroOperandsInSameScope.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 MemoizeFbtAndMacroOperandsInSameScope.ts?
MemoizeFbtAndMacroOperandsInSameScope.ts defines 5 function(s): expandFbtScopeRange, memoizeFbtAndMacroOperandsInSameScope, mergeMacroArguments, populateMacroTags, visitOperands.
What does MemoizeFbtAndMacroOperandsInSameScope.ts depend on?
MemoizeFbtAndMacroOperandsInSameScope.ts imports 5 module(s): Environment.ts, Macro, eachInstructionValueOperand, index.ts, visitors.ts.
What files import MemoizeFbtAndMacroOperandsInSameScope.ts?
MemoizeFbtAndMacroOperandsInSameScope.ts is imported by 1 file(s): CodegenReactiveFunction.ts.
Where is MemoizeFbtAndMacroOperandsInSameScope.ts in the architecture?
MemoizeFbtAndMacroOperandsInSameScope.ts is located at compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MemoizeFbtAndMacroOperandsInSameScope.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