Home / Function/ compareScopeDeclaration() — react Function Reference

compareScopeDeclaration() — react Function Reference

Architecture documentation for the compareScopeDeclaration() function in CodegenReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0cd5721d_3385_49af_c06a_4e7b0f6230da["compareScopeDeclaration()"]
  dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"]
  0cd5721d_3385_49af_c06a_4e7b0f6230da -->|defined in| dc7f10c2_c914_a162_d02b_a10a15c64a5f
  94638464_4710_0693_528f_4848cf25e876["codegenReactiveScope()"]
  94638464_4710_0693_528f_4848cf25e876 -->|calls| 0cd5721d_3385_49af_c06a_4e7b0f6230da
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  0cd5721d_3385_49af_c06a_4e7b0f6230da -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  style 0cd5721d_3385_49af_c06a_4e7b0f6230da fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts lines 2682–2698

function compareScopeDeclaration(
  a: ReactiveScopeDeclaration,
  b: ReactiveScopeDeclaration,
): number {
  CompilerError.invariant(
    a.identifier.name?.kind === 'named' && b.identifier.name?.kind === 'named',
    {
      reason: '[Codegen] Expected named identifier for declaration',
      loc: a.identifier.loc,
    },
  );
  const aName = a.identifier.name.value;
  const bName = b.identifier.name.value;
  if (aName < bName) return -1;
  else if (aName > bName) return 1;
  else return 0;
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does compareScopeDeclaration() do?
compareScopeDeclaration() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts.
Where is compareScopeDeclaration() defined?
compareScopeDeclaration() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts at line 2682.
What does compareScopeDeclaration() call?
compareScopeDeclaration() calls 1 function(s): invariant.
What calls compareScopeDeclaration()?
compareScopeDeclaration() is called by 1 function(s): codegenReactiveScope.

Analyze Your Own Codebase

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

Try Supermodel Free