Home / Function/ emit() — react Function Reference

emit() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2d212850_94bf_e0bb_e10d_403ccfc88d1d["emit()"]
  dc3f5251_a95c_3c77_5550_3882c13a37c9["InstructionReordering.ts"]
  2d212850_94bf_e0bb_e10d_403ccfc88d1d -->|defined in| dc3f5251_a95c_3c77_5550_3882c13a37c9
  c4483c48_7e67_41a0_1a7a_c6ca92a55123["reorderBlock()"]
  c4483c48_7e67_41a0_1a7a_c6ca92a55123 -->|calls| 2d212850_94bf_e0bb_e10d_403ccfc88d1d
  c7c1eb69_eed3_63a6_a393_058189e67642["getDepth()"]
  2d212850_94bf_e0bb_e10d_403ccfc88d1d -->|calls| c7c1eb69_eed3_63a6_a393_058189e67642
  style 2d212850_94bf_e0bb_e10d_403ccfc88d1d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts lines 439–464

function emit(
  env: Environment,
  locals: Nodes,
  shared: Nodes,
  instructions: Array<Instruction>,
  id: IdentifierId,
): void {
  const node = locals.get(id) ?? shared.get(id);
  if (node == null) {
    return;
  }
  locals.delete(id);
  shared.delete(id);
  const deps = [...node.dependencies];
  deps.sort((a, b) => {
    const aDepth = getDepth(env, locals, a);
    const bDepth = getDepth(env, locals, b);
    return bDepth - aDepth;
  });
  for (const dep of deps) {
    emit(env, locals, shared, instructions, dep);
  }
  if (node.instruction !== null) {
    instructions.push(node.instruction);
  }
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does emit() do?
emit() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts.
Where is emit() defined?
emit() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InstructionReordering.ts at line 439.
What does emit() call?
emit() calls 1 function(s): getDepth.
What calls emit()?
emit() 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