Home / Function/ visitOperand() — react Function Reference

visitOperand() — react Function Reference

Architecture documentation for the visitOperand() function in PruneNonEscapingScopes.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5efb04f8_fe7e_23f5_ada1_07f7e110af62["visitOperand()"]
  f90e2ba3_ca16_9654_f6d1_9282625ea4a4["State"]
  5efb04f8_fe7e_23f5_ada1_07f7e110af62 -->|defined in| f90e2ba3_ca16_9654_f6d1_9282625ea4a4
  97a5722d_5f85_030f_127a_0ee70f10e274["visitValueForMemoization()"]
  97a5722d_5f85_030f_127a_0ee70f10e274 -->|calls| 5efb04f8_fe7e_23f5_ada1_07f7e110af62
  7107ba22_4065_0956_1ec3_286f637d0d22["getPlaceScope()"]
  5efb04f8_fe7e_23f5_ada1_07f7e110af62 -->|calls| 7107ba22_4065_0956_1ec3_286f637d0d22
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  5efb04f8_fe7e_23f5_ada1_07f7e110af62 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"]
  5efb04f8_fe7e_23f5_ada1_07f7e110af62 -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da
  style 5efb04f8_fe7e_23f5_ada1_07f7e110af62 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneNonEscapingScopes.ts lines 247–272

  visitOperand(
    id: InstructionId,
    place: Place,
    identifier: DeclarationId,
  ): void {
    const scope = getPlaceScope(id, place);
    if (scope !== null) {
      let node = this.scopes.get(scope.id);
      if (node === undefined) {
        node = {
          dependencies: [...scope.dependencies].map(
            dep => dep.identifier.declarationId,
          ),
          seen: false,
        };
        this.scopes.set(scope.id, node);
      }
      const identifierNode = this.identifiers.get(identifier);
      CompilerError.invariant(identifierNode !== undefined, {
        reason: 'Expected identifier to be initialized',
        description: `[${id}] operand=${printPlace(place)} for identifier declaration ${identifier}`,
        loc: place.loc,
      });
      identifierNode.scopes.add(scope.id);
    }
  }

Domain

Subdomains

Frequently Asked Questions

What does visitOperand() do?
visitOperand() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneNonEscapingScopes.ts.
Where is visitOperand() defined?
visitOperand() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PruneNonEscapingScopes.ts at line 247.
What does visitOperand() call?
visitOperand() calls 3 function(s): getPlaceScope, invariant, printPlace.
What calls visitOperand()?
visitOperand() is called by 1 function(s): visitValueForMemoization.

Analyze Your Own Codebase

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

Try Supermodel Free