Home / Function/ addFunction() — react Function Reference

addFunction() — react Function Reference

Architecture documentation for the addFunction() function in ObjectShape.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5["addFunction()"]
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5 -->|defined in| 58f81300_7c82_5086_3e10_e46b5f3ab04d
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4["installTypeConfig()"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|calls| a77ff0f7_0c98_02df_9507_6da9eca5fbb5
  4ba5c3ad_186f_8c38_7db0_a6d2e5ee2b25["getReanimatedModuleType()"]
  4ba5c3ad_186f_8c38_7db0_a6d2e5ee2b25 -->|calls| a77ff0f7_0c98_02df_9507_6da9eca5fbb5
  d48f103d_be9e_0e54_7379_d248244a3c09["createAnonId()"]
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5 -->|calls| d48f103d_be9e_0e54_7379_d248244a3c09
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7["parseAliasingSignatureConfig()"]
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5 -->|calls| e3b73b76_4b2f_e1c7_6ea9_544f184a98e7
  54994d7a_c3e1_1a38_0769_4562dd8f15b4["addShape()"]
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5 -->|calls| 54994d7a_c3e1_1a38_0769_4562dd8f15b4
  style a77ff0f7_0c98_02df_9507_6da9eca5fbb5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts lines 58–83

export function addFunction(
  registry: ShapeRegistry,
  properties: Iterable<[string, BuiltInType | PolyType]>,
  fn: Omit<FunctionSignature, 'hookKind' | 'aliasing'> & {
    aliasing?: AliasingSignatureConfig | null | undefined;
  },
  id: string | null = null,
  isConstructor: boolean = false,
): FunctionType {
  const shapeId = id ?? createAnonId();
  const aliasing =
    fn.aliasing != null
      ? parseAliasingSignatureConfig(fn.aliasing, '<builtin>', GeneratedSource)
      : null;
  addShape(registry, shapeId, properties, {
    ...fn,
    aliasing,
    hookKind: null,
  });
  return {
    kind: 'Function',
    return: fn.returnType,
    shapeId,
    isConstructor,
  };
}

Subdomains

Frequently Asked Questions

What does addFunction() do?
addFunction() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts.
Where is addFunction() defined?
addFunction() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts at line 58.
What does addFunction() call?
addFunction() calls 3 function(s): addShape, createAnonId, parseAliasingSignatureConfig.
What calls addFunction()?
addFunction() is called by 2 function(s): getReanimatedModuleType, installTypeConfig.

Analyze Your Own Codebase

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

Try Supermodel Free