Home / Function/ emitOutlinedFn() — react Function Reference

emitOutlinedFn() — react Function Reference

Architecture documentation for the emitOutlinedFn() function in OutlineJsx.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972["emitOutlinedFn()"]
  158befb1_050c_87d2_b4ec_54305bac5a4f["OutlineJsx.ts"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|defined in| 158befb1_050c_87d2_b4ec_54305bac5a4f
  a18f6e8c_d3ca_2ed1_585d_9032b57ecfe4["process()"]
  a18f6e8c_d3ca_2ed1_585d_9032b57ecfe4 -->|calls| c201bbda_dc3c_7b58_7ce0_7d61d25ef972
  d6862a21_d6b5_bc01_57d7_ae9d1c1f23ce["createOldToNewPropsMapping()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| d6862a21_d6b5_bc01_57d7_ae9d1c1f23ce
  49446ae1_b830_9411_8258_1139d21b314b["createTemporaryPlace()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| 49446ae1_b830_9411_8258_1139d21b314b
  216a4c34_910d_7936_33eb_adf13df70310["promoteTemporary()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| 216a4c34_910d_7936_33eb_adf13df70310
  80dcbf5f_ebdd_7414_3c78_4a7de7b352b8["emitDestructureProps()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| 80dcbf5f_ebdd_7414_3c78_4a7de7b352b8
  53244187_914c_cc90_5880_7bfc1fc9c0bb["push()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| 53244187_914c_cc90_5880_7bfc1fc9c0bb
  66224640_ba7d_ee8a_5de1_ad0d81748cff["emitUpdatedJsx()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| 66224640_ba7d_ee8a_5de1_ad0d81748cff
  95c42a01_f55a_6d2d_20cd_137cc1fe34d6["emitLoadGlobals()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| 95c42a01_f55a_6d2d_20cd_137cc1fe34d6
  11080cce_bbf7_2d34_25af_532ed4173235["makeBlockId()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| 11080cce_bbf7_2d34_25af_532ed4173235
  d0270ab6_a621_bd55_a1b9_a5cad8b406b2["makeInstructionId()"]
  c201bbda_dc3c_7b58_7ce0_7d61d25ef972 -->|calls| d0270ab6_a621_bd55_a1b9_a5cad8b406b2
  style c201bbda_dc3c_7b58_7ce0_7d61d25ef972 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts lines 321–384

function emitOutlinedFn(
  env: Environment,
  jsx: Array<JsxInstruction>,
  oldProps: Array<OutlinedJsxAttribute>,
  globals: LoadGlobalMap,
): HIRFunction | null {
  const instructions: Array<Instruction> = [];
  const oldToNewProps = createOldToNewPropsMapping(env, oldProps);

  const propsObj: Place = createTemporaryPlace(env, GeneratedSource);
  promoteTemporary(propsObj.identifier);

  const destructurePropsInstr = emitDestructureProps(
    env,
    propsObj,
    oldToNewProps,
  );
  instructions.push(destructurePropsInstr);

  const updatedJsxInstructions = emitUpdatedJsx(jsx, oldToNewProps);
  const loadGlobalInstrs = emitLoadGlobals(jsx, globals);
  if (!loadGlobalInstrs) {
    return null;
  }
  instructions.push(...loadGlobalInstrs);
  instructions.push(...updatedJsxInstructions);

  const block: BasicBlock = {
    kind: 'block',
    id: makeBlockId(0),
    instructions,
    terminal: {
      id: makeInstructionId(0),
      kind: 'return',
      returnVariant: 'Explicit',
      loc: GeneratedSource,
      value: instructions.at(-1)!.lvalue,
      effects: null,
    },
    preds: new Set(),
    phis: new Set(),
  };

  const fn: HIRFunction = {
    loc: GeneratedSource,
    id: null,
    nameHint: null,
    fnType: 'Other',
    env,
    params: [propsObj],
    returnTypeAnnotation: null,
    returns: createTemporaryPlace(env, GeneratedSource),
    context: [],
    body: {
      entry: block.id,
      blocks: new Map([[block.id, block]]),
    },
    generator: false,
    async: false,
    directives: [],
    aliasingEffects: [],
  };
  return fn;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does emitOutlinedFn() do?
emitOutlinedFn() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts.
Where is emitOutlinedFn() defined?
emitOutlinedFn() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts at line 321.
What does emitOutlinedFn() call?
emitOutlinedFn() calls 9 function(s): createOldToNewPropsMapping, createTemporaryPlace, emitDestructureProps, emitLoadGlobals, emitUpdatedJsx, makeBlockId, makeInstructionId, promoteTemporary, and 1 more.
What calls emitOutlinedFn()?
emitOutlinedFn() is called by 1 function(s): process.

Analyze Your Own Codebase

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

Try Supermodel Free