Home / Type/ ReactiveScope Type — react Architecture

ReactiveScope Type — react Architecture

Architecture documentation for the ReactiveScope type/interface in HIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  ca9a6820_460e_0b15_8169_3aa4c6503770["ReactiveScope"]
  18a78965_f593_105b_e5e8_07001321c2ec["HIR.ts"]
  ca9a6820_460e_0b15_8169_3aa4c6503770 -->|defined in| 18a78965_f593_105b_e5e8_07001321c2ec
  style ca9a6820_460e_0b15_8169_3aa4c6503770 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts lines 1578–1623

export type ReactiveScope = {
  id: ScopeId;
  range: MutableRange;

  /**
   * The inputs to this reactive scope
   */
  dependencies: ReactiveScopeDependencies;

  /**
   * The set of values produced by this scope. This may be empty
   * for scopes that produce reassignments only.
   */
  declarations: Map<IdentifierId, ReactiveScopeDeclaration>;

  /**
   * A mutable range may sometimes include a reassignment of some variable.
   * This is the set of identifiers which are reassigned by this scope.
   */
  reassignments: Set<Identifier>;

  /**
   * Reactive scopes may contain a return statement, which needs to be replayed
   * whenever the inputs to the scope have not changed since the previous execution.
   * If the reactive scope has an early return, this variable stores the temporary
   * identifier to which the return value will be assigned. See PropagateEarlyReturns
   * for more about how early returns in reactive scopes are compiled and represented.
   *
   * This value is null for scopes that do not contain early returns.
   */
  earlyReturnValue: {
    value: Identifier;
    loc: SourceLocation;
    label: BlockId;
  } | null;

  /*
   * Some passes may merge scopes together. The merged set contains the
   * ids of scopes that were merged into this one, for passes that need
   * to track which scopes are still present (in some form) vs scopes that
   * no longer exist due to being pruned.
   */
  merged: Set<ScopeId>;

  loc: SourceLocation;
};

Frequently Asked Questions

What is the ReactiveScope type?
ReactiveScope is a type/interface in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts.
Where is ReactiveScope defined?
ReactiveScope is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts at line 1578.

Analyze Your Own Codebase

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

Try Supermodel Free