Home / Class/ PromoteAllInstancedOfPromotedTemporaries Class — react Architecture

PromoteAllInstancedOfPromotedTemporaries Class — react Architecture

Architecture documentation for the PromoteAllInstancedOfPromotedTemporaries class in PromoteUsedTemporaries.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1["PromoteAllInstancedOfPromotedTemporaries"]
  dea6b9e7_3c69_6e86_5d64_ba83c7d43ed6["PromoteUsedTemporaries.ts"]
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1 -->|defined in| dea6b9e7_3c69_6e86_5d64_ba83c7d43ed6
  5c61a7b2_e92f_44ab_4c80_8e3e17abee33["visitPlace()"]
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1 -->|method| 5c61a7b2_e92f_44ab_4c80_8e3e17abee33
  56c5b524_f307_3181_4b78_08089d442318["visitLValue()"]
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1 -->|method| 56c5b524_f307_3181_4b78_08089d442318
  130a4090_669d_40b7_28ec_e7c937c9c3b3["traverseScopeIdentifiers()"]
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1 -->|method| 130a4090_669d_40b7_28ec_e7c937c9c3b3
  9ecb747f_cf74_313d_4cec_4c32788af678["visitScope()"]
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1 -->|method| 9ecb747f_cf74_313d_4cec_4c32788af678
  b0eda56d_bc25_e1f0_6478_37239f37dbc3["visitPrunedScope()"]
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1 -->|method| b0eda56d_bc25_e1f0_6478_37239f37dbc3
  7f309c71_43ae_fe8e_5996_da58339b724c["visitReactiveFunctionValue()"]
  a4a59234_8b6b_31f7_3cdd_2c065b60eae1 -->|method| 7f309c71_43ae_fe8e_5996_da58339b724c

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PromoteUsedTemporaries.ts lines 109–170

class PromoteAllInstancedOfPromotedTemporaries extends ReactiveFunctionVisitor<State> {
  override visitPlace(_id: InstructionId, place: Place, state: State): void {
    if (
      place.identifier.name === null &&
      state.promoted.has(place.identifier.declarationId)
    ) {
      promoteIdentifier(place.identifier, state);
    }
  }
  override visitLValue(
    _id: InstructionId,
    _lvalue: Place,
    _state: State,
  ): void {
    this.visitPlace(_id, _lvalue, _state);
  }
  traverseScopeIdentifiers(scope: ReactiveScope, state: State): void {
    for (const [, decl] of scope.declarations) {
      if (
        decl.identifier.name === null &&
        state.promoted.has(decl.identifier.declarationId)
      ) {
        promoteIdentifier(decl.identifier, state);
      }
    }
    for (const dep of scope.dependencies) {
      if (
        dep.identifier.name === null &&
        state.promoted.has(dep.identifier.declarationId)
      ) {
        promoteIdentifier(dep.identifier, state);
      }
    }
    for (const reassignment of scope.reassignments) {
      if (
        reassignment.name === null &&
        state.promoted.has(reassignment.declarationId)
      ) {
        promoteIdentifier(reassignment, state);
      }
    }
  }
  override visitScope(scope: ReactiveScopeBlock, state: State): void {
    this.traverseScope(scope, state);
    this.traverseScopeIdentifiers(scope.scope, state);
  }
  override visitPrunedScope(
    scopeBlock: PrunedReactiveScopeBlock,
    state: State,
  ): void {
    this.traversePrunedScope(scopeBlock, state);
    this.traverseScopeIdentifiers(scopeBlock.scope, state);
  }
  override visitReactiveFunctionValue(
    _id: InstructionId,
    _dependencies: Array<Place>,
    fn: ReactiveFunction,
    state: State,
  ): void {
    visitReactiveFunction(fn, this, state);
  }
}

Domain

Frequently Asked Questions

What is the PromoteAllInstancedOfPromotedTemporaries class?
PromoteAllInstancedOfPromotedTemporaries is a class in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PromoteUsedTemporaries.ts.
Where is PromoteAllInstancedOfPromotedTemporaries defined?
PromoteAllInstancedOfPromotedTemporaries is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PromoteUsedTemporaries.ts at line 109.

Analyze Your Own Codebase

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

Try Supermodel Free