Home / File/ hoist-deps-diff-ssa-instance1.tsx — react Source File

hoist-deps-diff-ssa-instance1.tsx — react Source File

Architecture documentation for hoist-deps-diff-ssa-instance1.tsx, a tsx file in the react codebase. 1 imports, 0 dependents.

File tsx TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  c78c4327_2379_21a8_b9d9_29f75c72469a["hoist-deps-diff-ssa-instance1.tsx"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  c78c4327_2379_21a8_b9d9_29f75c72469a --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style c78c4327_2379_21a8_b9d9_29f75c72469a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

type HasA = {kind: 'hasA'; a: {value: number}};
type HasC = {kind: 'hasC'; c: {value: number}};
function Foo({cond}: {cond: boolean}) {
  let x: HasA | HasC = shallowCopy({kind: 'hasA', a: {value: 2}});
  /**
   * This read of x.a.value is outside of x's identifier mutable
   * range + scope range. We mark this ssa instance (x_@0) as having
   * a non-null object property `x.a`.
   */
  Math.max(x.a.value, 2);
  if (cond) {
    x = shallowCopy({kind: 'hasC', c: {value: 3}});
  }

  /**
   * Since this x (x_@2 = phi(x_@0, x_@1)) is a different ssa instance,
   * we cannot safely hoist a read of `x.a.value`
   */
  return <Stringify val={!cond && [(x as HasA).a.value + 2]} />;
}
export const FIXTURE_ENTRYPOINT = {
  fn: Foo,
  params: [{cond: false}],
  sequentialRenders: [{cond: false}, {cond: true}],
};

Subdomains

Functions

Types

Dependencies

  • shared-runtime

Frequently Asked Questions

What does hoist-deps-diff-ssa-instance1.tsx do?
hoist-deps-diff-ssa-instance1.tsx is a source file in the react codebase, written in tsx. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in hoist-deps-diff-ssa-instance1.tsx?
hoist-deps-diff-ssa-instance1.tsx defines 1 function(s): Foo.
What does hoist-deps-diff-ssa-instance1.tsx depend on?
hoist-deps-diff-ssa-instance1.tsx imports 1 module(s): shared-runtime.
Where is hoist-deps-diff-ssa-instance1.tsx in the architecture?
hoist-deps-diff-ssa-instance1.tsx is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/hoist-deps-diff-ssa-instance1.tsx (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps).

Analyze Your Own Codebase

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

Try Supermodel Free