Home / Function/ lowerIdentifier() — react Function Reference

lowerIdentifier() — react Function Reference

Architecture documentation for the lowerIdentifier() function in BuildHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  b210ff8f_3273_1b70_4f00_b08cc41fd3dd["lowerIdentifier()"]
  e04c04d6_37a7_1dc3_7fae_7d07660d0af9["BuildHIR.ts"]
  b210ff8f_3273_1b70_4f00_b08cc41fd3dd -->|defined in| e04c04d6_37a7_1dc3_7fae_7d07660d0af9
  ace1177a_10b2_b870_31fd_da4aa845554c["lowerExpression()"]
  ace1177a_10b2_b870_31fd_da4aa845554c -->|calls| b210ff8f_3273_1b70_4f00_b08cc41fd3dd
  bc571674_9276_a5d1_38b8_101118e7d161["lowerJsxElementName()"]
  bc571674_9276_a5d1_38b8_101118e7d161 -->|calls| b210ff8f_3273_1b70_4f00_b08cc41fd3dd
  7477f6f4_c8ce_95b3_d35f_2f53341af86d["lowerJsxMemberExpression()"]
  7477f6f4_c8ce_95b3_d35f_2f53341af86d -->|calls| b210ff8f_3273_1b70_4f00_b08cc41fd3dd
  c753d1dc_3d72_6c26_43d1_a3614937be80["resolveIdentifier()"]
  b210ff8f_3273_1b70_4f00_b08cc41fd3dd -->|calls| c753d1dc_3d72_6c26_43d1_a3614937be80
  f1f0c182_09ad_b29e_b1ca_56f10046adff["lowerValueToTemporary()"]
  b210ff8f_3273_1b70_4f00_b08cc41fd3dd -->|calls| f1f0c182_09ad_b29e_b1ca_56f10046adff
  073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"]
  b210ff8f_3273_1b70_4f00_b08cc41fd3dd -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83
  style b210ff8f_3273_1b70_4f00_b08cc41fd3dd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts lines 3548–3584

function lowerIdentifier(
  builder: HIRBuilder,
  exprPath: NodePath<t.Identifier | t.JSXIdentifier>,
): Place {
  const exprNode = exprPath.node;
  const exprLoc = exprNode.loc ?? GeneratedSource;
  const binding = builder.resolveIdentifier(exprPath);
  switch (binding.kind) {
    case 'Identifier': {
      const place: Place = {
        kind: 'Identifier',
        identifier: binding.identifier,
        effect: Effect.Unknown,
        reactive: false,
        loc: exprLoc,
      };
      return place;
    }
    default: {
      if (binding.kind === 'Global' && binding.name === 'eval') {
        builder.errors.push({
          reason: `The 'eval' function is not supported`,
          description:
            'Eval is an anti-pattern in JavaScript, and the code executed cannot be evaluated by React Compiler',
          category: ErrorCategory.UnsupportedSyntax,
          loc: exprPath.node.loc ?? null,
          suggestions: null,
        });
      }
      return lowerValueToTemporary(builder, {
        kind: 'LoadGlobal',
        binding,
        loc: exprLoc,
      });
    }
  }
}

Subdomains

Frequently Asked Questions

What does lowerIdentifier() do?
lowerIdentifier() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts.
Where is lowerIdentifier() defined?
lowerIdentifier() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts at line 3548.
What does lowerIdentifier() call?
lowerIdentifier() calls 3 function(s): lowerValueToTemporary, push, resolveIdentifier.
What calls lowerIdentifier()?
lowerIdentifier() is called by 3 function(s): lowerExpression, lowerJsxElementName, lowerJsxMemberExpression.

Analyze Your Own Codebase

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

Try Supermodel Free