Home / Type/ CodegenFunction Type — react Architecture

CodegenFunction Type — react Architecture

Architecture documentation for the CodegenFunction type/interface in CodegenReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  3a833616_d9a0_6cb8_d13d_295a368341ac["CodegenFunction"]
  dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"]
  3a833616_d9a0_6cb8_d13d_295a368341ac -->|defined in| dc7f10c2_c914_a162_d02b_a10a15c64a5f
  style 3a833616_d9a0_6cb8_d13d_295a368341ac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts lines 61–114

export type CodegenFunction = {
  type: 'CodegenFunction';
  id: t.Identifier | null;
  nameHint: string | null;
  params: t.FunctionDeclaration['params'];
  body: t.BlockStatement;
  generator: boolean;
  async: boolean;
  loc: SourceLocation;

  /*
   * Compiler info for logging and heuristics
   * Number of memo slots (value passed to useMemoCache)
   */
  memoSlotsUsed: number;
  /*
   * Number of memo *blocks* (reactive scopes) regardless of
   * how many inputs/outputs each block has
   */
  memoBlocks: number;

  /**
   * Number of memoized values across all reactive scopes
   */
  memoValues: number;

  /**
   * The number of reactive scopes that were created but had to be discarded
   * because they contained hook calls.
   */
  prunedMemoBlocks: number;

  /**
   * The total number of values that should have been memoized but weren't
   * because they were part of a pruned memo block.
   */
  prunedMemoValues: number;

  outlined: Array<{
    fn: CodegenFunction;
    type: ReactFunctionType | null;
  }>;

  /**
   * This is true if the compiler has compiled inferred effect dependencies
   */
  hasInferredEffect: boolean;
  inferredEffectLocations: Set<SourceLocation>;

  /**
   * This is true if the compiler has compiled a fire to a useFire call
   */
  hasFireRewrite: boolean;
};

Frequently Asked Questions

What is the CodegenFunction type?
CodegenFunction is a type/interface in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts.
Where is CodegenFunction defined?
CodegenFunction is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts at line 61.

Analyze Your Own Codebase

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

Try Supermodel Free