Home / Function/ visitScope() — react Function Reference

visitScope() — react Function Reference

Architecture documentation for the visitScope() function in ValidatePreservedManualMemoization.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7d870135_2212_e6ce_9c8d_5751aca84f6f["visitScope()"]
  310c2965_2897_08a7_588d_8109c9f88c0c["Visitor"]
  7d870135_2212_e6ce_9c8d_5751aca84f6f -->|defined in| 310c2965_2897_08a7_588d_8109c9f88c0c
  2eebfc2b_b1f6_9f25_ad32_78be0b56f06b["traverseScope()"]
  7d870135_2212_e6ce_9c8d_5751aca84f6f -->|calls| 2eebfc2b_b1f6_9f25_ad32_78be0b56f06b
  4acb57df_5348_9aab_9691_41cf35127db4["visitScope()"]
  7d870135_2212_e6ce_9c8d_5751aca84f6f -->|calls| 4acb57df_5348_9aab_9691_41cf35127db4
  6216fd83_7c2d_7eac_782b_6a1697ce7175["validateInferredDep()"]
  7d870135_2212_e6ce_9c8d_5751aca84f6f -->|calls| 6216fd83_7c2d_7eac_782b_6a1697ce7175
  style 7d870135_2212_e6ce_9c8d_5751aca84f6f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts lines 416–442

  override visitScope(
    scopeBlock: ReactiveScopeBlock,
    state: VisitorState,
  ): void {
    this.traverseScope(scopeBlock, state);

    if (
      state.manualMemoState != null &&
      state.manualMemoState.depsFromSource != null
    ) {
      for (const dep of scopeBlock.scope.dependencies) {
        validateInferredDep(
          dep,
          this.temporaries,
          state.manualMemoState.decls,
          state.manualMemoState.depsFromSource,
          state.errors,
          state.manualMemoState.loc,
        );
      }
    }

    this.scopes.add(scopeBlock.scope.id);
    for (const id of scopeBlock.scope.merged) {
      this.scopes.add(id);
    }
  }

Domain

Subdomains

Frequently Asked Questions

What does visitScope() do?
visitScope() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts.
Where is visitScope() defined?
visitScope() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts at line 416.
What does visitScope() call?
visitScope() calls 3 function(s): traverseScope, validateInferredDep, visitScope.

Analyze Your Own Codebase

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

Try Supermodel Free