Home / Function/ mergeLocation() — react Function Reference

mergeLocation() — react Function Reference

Architecture documentation for the mergeLocation() function in InferReactiveScopeVariables.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  67fd32f8_58dc_29cf_d2ca_7d0f11d2763f["mergeLocation()"]
  f041318d_301f_daad_4198_91d141b3039d["InferReactiveScopeVariables.ts"]
  67fd32f8_58dc_29cf_d2ca_7d0f11d2763f -->|defined in| f041318d_301f_daad_4198_91d141b3039d
  956ca4bb_7b0f_7eb2_4fbb_bda123ddbc98["inferReactiveScopeVariables()"]
  956ca4bb_7b0f_7eb2_4fbb_bda123ddbc98 -->|calls| 67fd32f8_58dc_29cf_d2ca_7d0f11d2763f
  style 67fd32f8_58dc_29cf_d2ca_7d0f11d2763f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/InferReactiveScopeVariables.ts lines 174–195

function mergeLocation(l: SourceLocation, r: SourceLocation): SourceLocation {
  if (l === GeneratedSource) {
    return r;
  } else if (r === GeneratedSource) {
    return l;
  } else {
    return {
      filename: l.filename,
      identifierName: l.identifierName,
      start: {
        index: Math.min(l.start.index, r.start.index),
        line: Math.min(l.start.line, r.start.line),
        column: Math.min(l.start.column, r.start.column),
      },
      end: {
        index: Math.max(l.end.index, r.end.index),
        line: Math.max(l.end.line, r.end.line),
        column: Math.max(l.end.column, r.end.column),
      },
    };
  }
}

Domain

Subdomains

Frequently Asked Questions

What does mergeLocation() do?
mergeLocation() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/InferReactiveScopeVariables.ts.
Where is mergeLocation() defined?
mergeLocation() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/InferReactiveScopeVariables.ts at line 174.
What calls mergeLocation()?
mergeLocation() is called by 1 function(s): inferReactiveScopeVariables.

Analyze Your Own Codebase

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

Try Supermodel Free