Home / Function/ assertConsistentIdentifiers() — react Function Reference

assertConsistentIdentifiers() — react Function Reference

Architecture documentation for the assertConsistentIdentifiers() function in AssertConsistentIdentifiers.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  505f2e0b_d43c_5972_8865_373d0dd08a6a["assertConsistentIdentifiers()"]
  277c518d_edde_d1c4_b70b_db27c08ecf93["AssertConsistentIdentifiers.ts"]
  505f2e0b_d43c_5972_8865_373d0dd08a6a -->|defined in| 277c518d_edde_d1c4_b70b_db27c08ecf93
  2d5af54d_63a3_470d_02e8_a6c9fbb9f052["validate()"]
  505f2e0b_d43c_5972_8865_373d0dd08a6a -->|calls| 2d5af54d_63a3_470d_02e8_a6c9fbb9f052
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  505f2e0b_d43c_5972_8865_373d0dd08a6a -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"]
  505f2e0b_d43c_5972_8865_373d0dd08a6a -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da
  10043bf1_f7ee_9ed9_307a_fe3edfd02b09["eachInstructionLValue()"]
  505f2e0b_d43c_5972_8865_373d0dd08a6a -->|calls| 10043bf1_f7ee_9ed9_307a_fe3edfd02b09
  b2fc2985_a7ba_9865_c2a3_2a7531f27d44["eachInstructionValueOperand()"]
  505f2e0b_d43c_5972_8865_373d0dd08a6a -->|calls| b2fc2985_a7ba_9865_c2a3_2a7531f27d44
  41232a25_deb6_6e83_05a8_ae9f961656f7["eachTerminalOperand()"]
  505f2e0b_d43c_5972_8865_373d0dd08a6a -->|calls| 41232a25_deb6_6e83_05a8_ae9f961656f7
  style 505f2e0b_d43c_5972_8865_373d0dd08a6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/AssertConsistentIdentifiers.ts lines 27–62

export function assertConsistentIdentifiers(fn: HIRFunction): void {
  const identifiers: Identifiers = new Map();
  const assignments: Set<IdentifierId> = new Set();
  for (const [, block] of fn.body.blocks) {
    for (const phi of block.phis) {
      validate(identifiers, phi.place.identifier);
      for (const [, operand] of phi.operands) {
        validate(identifiers, operand.identifier);
      }
    }
    for (const instr of block.instructions) {
      CompilerError.invariant(instr.lvalue.identifier.name === null, {
        reason: `Expected all lvalues to be temporaries`,
        description: `Found named lvalue \`${instr.lvalue.identifier.name}\``,
        loc: instr.lvalue.loc,
      });
      CompilerError.invariant(!assignments.has(instr.lvalue.identifier.id), {
        reason: `Expected lvalues to be assigned exactly once`,
        description: `Found duplicate assignment of '${printPlace(
          instr.lvalue,
        )}'`,
        loc: instr.lvalue.loc,
      });
      assignments.add(instr.lvalue.identifier.id);
      for (const operand of eachInstructionLValue(instr)) {
        validate(identifiers, operand.identifier, operand.loc);
      }
      for (const operand of eachInstructionValueOperand(instr.value)) {
        validate(identifiers, operand.identifier, operand.loc);
      }
    }
    for (const operand of eachTerminalOperand(block.terminal)) {
      validate(identifiers, operand.identifier, operand.loc);
    }
  }
}

Subdomains

Frequently Asked Questions

What does assertConsistentIdentifiers() do?
assertConsistentIdentifiers() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/AssertConsistentIdentifiers.ts.
Where is assertConsistentIdentifiers() defined?
assertConsistentIdentifiers() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/AssertConsistentIdentifiers.ts at line 27.
What does assertConsistentIdentifiers() call?
assertConsistentIdentifiers() calls 6 function(s): eachInstructionLValue, eachInstructionValueOperand, eachTerminalOperand, invariant, printPlace, validate.

Analyze Your Own Codebase

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

Try Supermodel Free