Home / Function/ parseAliasingSignatureConfig() — react Function Reference

parseAliasingSignatureConfig() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7["parseAliasingSignatureConfig()"]
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7 -->|defined in| 58f81300_7c82_5086_3e10_e46b5f3ab04d
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5["addFunction()"]
  a77ff0f7_0c98_02df_9507_6da9eca5fbb5 -->|calls| e3b73b76_4b2f_e1c7_6ea9_544f184a98e7
  d0882928_65af_dce8_5416_84ed7f492587["addHook()"]
  d0882928_65af_dce8_5416_84ed7f492587 -->|calls| e3b73b76_4b2f_e1c7_6ea9_544f184a98e7
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  cf7ad9bc_bfc5_bfed_c15e_762d1f3aa262["signatureArgument()"]
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7 -->|calls| cf7ad9bc_bfc5_bfed_c15e_762d1f3aa262
  cf8d627e_c2f0_6cd4_e5fc_35f3c7005b64["throwTodo()"]
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7 -->|calls| cf8d627e_c2f0_6cd4_e5fc_35f3c7005b64
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"]
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6
  style e3b73b76_4b2f_e1c7_6ea9_544f184a98e7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts lines 112–234

function parseAliasingSignatureConfig(
  typeConfig: AliasingSignatureConfig,
  moduleName: string,
  loc: SourceLocation,
): AliasingSignature {
  const lifetimes = new Map<string, Place>();
  function define(temp: string): Place {
    CompilerError.invariant(!lifetimes.has(temp), {
      reason: `Invalid type configuration for module`,
      description: `Expected aliasing signature to have unique names for receiver, params, rest, returns, and temporaries in module '${moduleName}'`,
      loc,
    });
    const place = signatureArgument(lifetimes.size);
    lifetimes.set(temp, place);
    return place;
  }
  function lookup(temp: string): Place {
    const place = lifetimes.get(temp);
    CompilerError.invariant(place != null, {
      reason: `Invalid type configuration for module`,
      description: `Expected aliasing signature effects to reference known names from receiver/params/rest/returns/temporaries, but '${temp}' is not a known name in '${moduleName}'`,
      loc,
    });
    return place;
  }
  const receiver = define(typeConfig.receiver);
  const params = typeConfig.params.map(define);
  const rest = typeConfig.rest != null ? define(typeConfig.rest) : null;
  const returns = define(typeConfig.returns);
  const temporaries = typeConfig.temporaries.map(define);
  const effects = typeConfig.effects.map(
    (effect: AliasingEffectConfig): AliasingEffect => {
      switch (effect.kind) {
        case 'ImmutableCapture':
        case 'CreateFrom':
        case 'Capture':
        case 'Alias':
        case 'Assign': {
          const from = lookup(effect.from);
          const into = lookup(effect.into);
          return {
            kind: effect.kind,
            from,
            into,
          };
        }
        case 'Mutate':
        case 'MutateTransitiveConditionally': {
          const value = lookup(effect.value);
          return {kind: effect.kind, value};
        }
        case 'Create': {
          const into = lookup(effect.into);
          return {
            kind: 'Create',
            into,
            reason: effect.reason,
            value: effect.value,
          };
        }
        case 'Freeze': {
          const value = lookup(effect.value);
          return {
            kind: 'Freeze',
            value,
            reason: effect.reason,
          };
        }
        case 'Impure': {
          const place = lookup(effect.place);
          return {
            kind: 'Impure',
            place,
            error: CompilerError.throwTodo({
              reason: 'Support impure effect declarations',
              loc: GeneratedSource,
            }),
          };
        }
        case 'Apply': {
          const receiver = lookup(effect.receiver);

Subdomains

Frequently Asked Questions

What does parseAliasingSignatureConfig() do?
parseAliasingSignatureConfig() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts.
Where is parseAliasingSignatureConfig() defined?
parseAliasingSignatureConfig() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts at line 112.
What does parseAliasingSignatureConfig() call?
parseAliasingSignatureConfig() calls 4 function(s): assertExhaustive, invariant, signatureArgument, throwTodo.
What calls parseAliasingSignatureConfig()?
parseAliasingSignatureConfig() is called by 2 function(s): addFunction, addHook.

Analyze Your Own Codebase

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

Try Supermodel Free