Home / File/ mutate-outer-scope-within-value-block.ts — react Source File

mutate-outer-scope-within-value-block.ts — react Source File

Architecture documentation for mutate-outer-scope-within-value-block.ts, a typescript file in the react codebase. 1 imports, 0 dependents.

File typescript TestingUtilities Fixtures 1 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  b8549d22_2c44_91b0_eac5_368b3f20b366["mutate-outer-scope-within-value-block.ts"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  b8549d22_2c44_91b0_eac5_368b3f20b366 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style b8549d22_2c44_91b0_eac5_368b3f20b366 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {CONST_TRUE, identity, shallowCopy} from 'shared-runtime';

function mutate(_: unknown) {}

/**
 * There are three values with their own scopes in this fixture.
 * - arr, whose mutable range extends to the `mutate(...)` call
 * - cond, which has a mutable range of exactly 1 (e.g. created but not
 *   mutated)
 * - { val: CONST_TRUE }, which is also not mutated after creation. However,
 *   its scope range becomes extended to the value block.
 *
 * After AlignScopesToBlockScopes, our scopes look roughly like this
 * ```js
 *  [1] arr = shallowCopy()            ⌝@0
 *  [2] cond = identity()        <- @1 |
 *  [3] $0 = Ternary test=cond     ⌝@2 |
 *  [4]        {val : CONST_TRUE}  |   |
 *  [5]        mutate(arr)         |   |
 *  [6] return $0                  ⌟   ⌟
 * ```
 *
 * Observe that instruction 5 mutates scope 0, which means that scopes 0 and 2
 * should be merged.
 */
function useFoo({input}) {
  const arr = shallowCopy(input);

  const cond = identity(false);
  return cond ? {val: CONST_TRUE} : mutate(arr);
}

export const FIXTURE_ENTRYPOINT = {
  fn: useFoo,
  params: [{input: 3}],
};

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

What does mutate-outer-scope-within-value-block.ts do?
mutate-outer-scope-within-value-block.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in mutate-outer-scope-within-value-block.ts?
mutate-outer-scope-within-value-block.ts defines 2 function(s): mutate, useFoo.
What does mutate-outer-scope-within-value-block.ts depend on?
mutate-outer-scope-within-value-block.ts imports 1 module(s): shared-runtime.
Where is mutate-outer-scope-within-value-block.ts in the architecture?
mutate-outer-scope-within-value-block.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutate-outer-scope-within-value-block.ts (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free