Home / Function/ createSymbolProperty() — react Function Reference

createSymbolProperty() — react Function Reference

Architecture documentation for the createSymbolProperty() function in InlineJsxTransform.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  3a3806e3_42f0_42cf_30a6_86392fd83dcf["createSymbolProperty()"]
  5e75c578_acd8_79e6_2aae_0bb0b2c9ce77["InlineJsxTransform.ts"]
  3a3806e3_42f0_42cf_30a6_86392fd83dcf -->|defined in| 5e75c578_acd8_79e6_2aae_0bb0b2c9ce77
  876d58c8_bfce_a9d8_22c0_b40cc7e22553["inlineJsxTransform()"]
  876d58c8_bfce_a9d8_22c0_b40cc7e22553 -->|calls| 3a3806e3_42f0_42cf_30a6_86392fd83dcf
  49446ae1_b830_9411_8258_1139d21b314b["createTemporaryPlace()"]
  3a3806e3_42f0_42cf_30a6_86392fd83dcf -->|calls| 49446ae1_b830_9411_8258_1139d21b314b
  53244187_914c_cc90_5880_7bfc1fc9c0bb["push()"]
  3a3806e3_42f0_42cf_30a6_86392fd83dcf -->|calls| 53244187_914c_cc90_5880_7bfc1fc9c0bb
  style 3a3806e3_42f0_42cf_30a6_86392fd83dcf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts lines 430–502

function createSymbolProperty(
  fn: HIRFunction,
  instr: Instruction,
  nextInstructions: Array<Instruction>,
  propertyName: string,
  symbolName: string,
): ObjectProperty {
  const symbolPlace = createTemporaryPlace(fn.env, instr.value.loc);
  const symbolInstruction: Instruction = {
    id: makeInstructionId(0),
    lvalue: {...symbolPlace, effect: Effect.Mutate},
    value: {
      kind: 'LoadGlobal',
      binding: {kind: 'Global', name: 'Symbol'},
      loc: instr.value.loc,
    },
    effects: null,
    loc: instr.loc,
  };
  nextInstructions.push(symbolInstruction);

  const symbolForPlace = createTemporaryPlace(fn.env, instr.value.loc);
  const symbolForInstruction: Instruction = {
    id: makeInstructionId(0),
    lvalue: {...symbolForPlace, effect: Effect.Read},
    value: {
      kind: 'PropertyLoad',
      object: {...symbolInstruction.lvalue},
      property: makePropertyLiteral('for'),
      loc: instr.value.loc,
    },
    effects: null,
    loc: instr.loc,
  };
  nextInstructions.push(symbolForInstruction);

  const symbolValuePlace = createTemporaryPlace(fn.env, instr.value.loc);
  const symbolValueInstruction: Instruction = {
    id: makeInstructionId(0),
    lvalue: {...symbolValuePlace, effect: Effect.Mutate},
    value: {
      kind: 'Primitive',
      value: symbolName,
      loc: instr.value.loc,
    },
    effects: null,
    loc: instr.loc,
  };
  nextInstructions.push(symbolValueInstruction);

  const $$typeofPlace = createTemporaryPlace(fn.env, instr.value.loc);
  const $$typeofInstruction: Instruction = {
    id: makeInstructionId(0),
    lvalue: {...$$typeofPlace, effect: Effect.Mutate},
    value: {
      kind: 'MethodCall',
      receiver: symbolInstruction.lvalue,
      property: symbolForInstruction.lvalue,
      args: [symbolValueInstruction.lvalue],
      loc: instr.value.loc,
    },
    effects: null,
    loc: instr.loc,
  };
  const $$typeofProperty: ObjectProperty = {
    kind: 'ObjectProperty',
    key: {name: propertyName, kind: 'string'},
    type: 'property',
    place: {...$$typeofPlace, effect: Effect.Capture},
  };
  nextInstructions.push($$typeofInstruction);
  return $$typeofProperty;
}

Domain

Subdomains

Frequently Asked Questions

What does createSymbolProperty() do?
createSymbolProperty() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts.
Where is createSymbolProperty() defined?
createSymbolProperty() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts at line 430.
What does createSymbolProperty() call?
createSymbolProperty() calls 2 function(s): createTemporaryPlace, push.
What calls createSymbolProperty()?
createSymbolProperty() is called by 1 function(s): inlineJsxTransform.

Analyze Your Own Codebase

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

Try Supermodel Free