Home / Function/ getReorderability() — react Function Reference

getReorderability() — react Function Reference

Architecture documentation for the getReorderability() function in InstructionReordering.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  31c9e602_0962_eeca_6bcc_07f1b49ca385["getReorderability()"]
  dc3f5251_a95c_3c77_5550_3882c13a37c9["InstructionReordering.ts"]
  31c9e602_0962_eeca_6bcc_07f1b49ca385 -->|defined in| dc3f5251_a95c_3c77_5550_3882c13a37c9
  c4483c48_7e67_41a0_1a7a_c6ca92a55123["reorderBlock()"]
  c4483c48_7e67_41a0_1a7a_c6ca92a55123 -->|calls| 31c9e602_0962_eeca_6bcc_07f1b49ca385
  style 31c9e602_0962_eeca_6bcc_07f1b49ca385 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts lines 470–503

function getReorderability(
  instr: Instruction,
  references: References,
): Reorderability {
  switch (instr.value.kind) {
    case 'JsxExpression':
    case 'JsxFragment':
    case 'JSXText':
    case 'LoadGlobal':
    case 'Primitive':
    case 'TemplateLiteral':
    case 'BinaryExpression':
    case 'UnaryExpression': {
      return Reorderability.Reorderable;
    }
    case 'LoadLocal': {
      const name = instr.value.place.identifier.name;
      if (name !== null && name.kind === 'named') {
        const lastAssignment = references.lastAssignments.get(name.value);
        if (
          lastAssignment !== undefined &&
          lastAssignment < instr.id &&
          references.singleUseIdentifiers.has(instr.lvalue.identifier.id)
        ) {
          return Reorderability.Reorderable;
        }
      }
      return Reorderability.Nonreorderable;
    }
    default: {
      return Reorderability.Nonreorderable;
    }
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getReorderability() do?
getReorderability() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts.
Where is getReorderability() defined?
getReorderability() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts at line 470.
What calls getReorderability()?
getReorderability() is called by 1 function(s): reorderBlock.

Analyze Your Own Codebase

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

Try Supermodel Free