Home / Class/ CountMemoBlockVisitor Class — react Architecture

CountMemoBlockVisitor Class — react Architecture

Architecture documentation for the CountMemoBlockVisitor class in CodegenReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9bbc5bc9_6c05_9d1a_15c0_dd51c82e4c60["CountMemoBlockVisitor"]
  dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"]
  9bbc5bc9_6c05_9d1a_15c0_dd51c82e4c60 -->|defined in| dc7f10c2_c914_a162_d02b_a10a15c64a5f
  2a0f45c9_912b_9826_cd9b_b9cdc6626857["constructor()"]
  9bbc5bc9_6c05_9d1a_15c0_dd51c82e4c60 -->|method| 2a0f45c9_912b_9826_cd9b_b9cdc6626857
  6bde27eb_b10a_161b_e61d_77c7196111ac["visitScope()"]
  9bbc5bc9_6c05_9d1a_15c0_dd51c82e4c60 -->|method| 6bde27eb_b10a_161b_e61d_77c7196111ac
  69733626_e3e0_3385_c1b9_4c1279a07d6f["visitPrunedScope()"]
  9bbc5bc9_6c05_9d1a_15c0_dd51c82e4c60 -->|method| 69733626_e3e0_3385_c1b9_4c1279a07d6f

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts lines 396–422

class CountMemoBlockVisitor extends ReactiveFunctionVisitor<void> {
  env: Environment;
  memoBlocks: number = 0;
  memoValues: number = 0;
  prunedMemoBlocks: number = 0;
  prunedMemoValues: number = 0;

  constructor(env: Environment) {
    super();
    this.env = env;
  }

  override visitScope(scopeBlock: ReactiveScopeBlock, state: void): void {
    this.memoBlocks += 1;
    this.memoValues += scopeBlock.scope.declarations.size;
    this.traverseScope(scopeBlock, state);
  }

  override visitPrunedScope(
    scopeBlock: PrunedReactiveScopeBlock,
    state: void,
  ): void {
    this.prunedMemoBlocks += 1;
    this.prunedMemoValues += scopeBlock.scope.declarations.size;
    this.traversePrunedScope(scopeBlock, state);
  }
}

Domain

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free