Home / Function/ printInstructionValue() — react Function Reference

printInstructionValue() — react Function Reference

Architecture documentation for the printInstructionValue() function in PrintHIR.ts from the react codebase.

Function typescript MIRInfrastructure HIR calls 12 called by 5

Entity Profile

Dependency Diagram

graph TD
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e["printInstructionValue()"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|defined in| 6976a9ee_9d8e_4f16_3016_495f39aff2fd
  27402418_1586_dfa4_858b_40693675cab9["printMixedHIR()"]
  27402418_1586_dfa4_858b_40693675cab9 -->|calls| f3619b34_2818_79d3_d2a6_72b9bcfc9d1e
  1bdf9e01_ffb0_1422_a451_e62965a1969b["printInstruction()"]
  1bdf9e01_ffb0_1422_a451_e62965a1969b -->|calls| f3619b34_2818_79d3_d2a6_72b9bcfc9d1e
  1028b1e9_aaf3_f6b1_21dd_0c83f1c827e7["define()"]
  1028b1e9_aaf3_f6b1_21dd_0c83f1c827e7 -->|calls| f3619b34_2818_79d3_d2a6_72b9bcfc9d1e
  0b368f40_7a34_9775_9972_d6bce52eb643["debug()"]
  0b368f40_7a34_9775_9972_d6bce52eb643 -->|calls| f3619b34_2818_79d3_d2a6_72b9bcfc9d1e
  71a9f37b_77ef_a53d_21a5_a209ffc89311["writeReactiveValue()"]
  71a9f37b_77ef_a53d_21a5_a209ffc89311 -->|calls| f3619b34_2818_79d3_d2a6_72b9bcfc9d1e
  bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da
  4f3ef840_195e_788b_c943_d7e4af3827be["printHole()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| 4f3ef840_195e_788b_c943_d7e4af3827be
  073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83
  8feba833_c46a_51b7_3da0_fcdfe54673b7["printObjectPropertyKey()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| 8feba833_c46a_51b7_3da0_fcdfe54673b7
  cd2a20a9_1741_622b_6efc_d63bea24cb4c["printPattern()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| cd2a20a9_1741_622b_6efc_d63bea24cb4c
  98665ce3_667d_9b3b_7526_24c349380b2e["printType()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| 98665ce3_667d_9b3b_7526_24c349380b2e
  2b0644d7_3881_88a9_fdf0_a00d41de5414["getFunctionName()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| 2b0644d7_3881_88a9_fdf0_a00d41de5414
  75108b98_1828_cb14_243d_e48c6613b748["printFunction()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| 75108b98_1828_cb14_243d_e48c6613b748
  style f3619b34_2818_79d3_d2a6_72b9bcfc9d1e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts lines 355–721

export function printInstructionValue(instrValue: ReactiveValue): string {
  let value = '';
  switch (instrValue.kind) {
    case 'ArrayExpression': {
      value = `Array [${instrValue.elements
        .map(element => {
          if (element.kind === 'Identifier') {
            return printPlace(element);
          } else if (element.kind === 'Hole') {
            return printHole();
          } else {
            return `...${printPlace(element.place)}`;
          }
        })
        .join(', ')}]`;
      break;
    }
    case 'ObjectExpression': {
      const properties = [];
      if (instrValue.properties !== null) {
        for (const property of instrValue.properties) {
          if (property.kind === 'ObjectProperty') {
            properties.push(
              `${printObjectPropertyKey(property.key)}: ${printPlace(
                property.place,
              )}`,
            );
          } else {
            properties.push(`...${printPlace(property.place)}`);
          }
        }
      }
      value = `Object { ${properties.join(', ')} }`;
      break;
    }
    case 'UnaryExpression': {
      value = `Unary ${printPlace(instrValue.value)}`;
      break;
    }
    case 'BinaryExpression': {
      value = `Binary ${printPlace(instrValue.left)} ${
        instrValue.operator
      } ${printPlace(instrValue.right)}`;
      break;
    }
    case 'NewExpression': {
      value = `New ${printPlace(instrValue.callee)}(${instrValue.args
        .map(arg => printPattern(arg))
        .join(', ')})`;
      break;
    }
    case 'CallExpression': {
      value = `Call ${printPlace(instrValue.callee)}(${instrValue.args
        .map(arg => printPattern(arg))
        .join(', ')})`;
      break;
    }
    case 'MethodCall': {
      value = `MethodCall ${printPlace(instrValue.receiver)}.${printPlace(
        instrValue.property,
      )}(${instrValue.args.map(arg => printPattern(arg)).join(', ')})`;
      break;
    }
    case 'JSXText': {
      value = `JSXText ${JSON.stringify(instrValue.value)}`;
      break;
    }
    case 'Primitive': {
      if (instrValue.value === undefined) {
        value = '<undefined>';
      } else {
        value = JSON.stringify(instrValue.value);
      }
      break;
    }
    case 'TypeCastExpression': {
      value = `TypeCast ${printPlace(instrValue.value)}: ${printType(
        instrValue.type,
      )}`;
      break;
    }

Subdomains

Frequently Asked Questions

What does printInstructionValue() do?
printInstructionValue() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts.
Where is printInstructionValue() defined?
printInstructionValue() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts at line 355.
What does printInstructionValue() call?
printInstructionValue() calls 12 function(s): assertExhaustive, getFunctionName, invariant, printFunction, printHole, printInstruction, printManualMemoDependency, printObjectPropertyKey, and 4 more.
What calls printInstructionValue()?
printInstructionValue() is called by 5 function(s): debug, define, printInstruction, printMixedHIR, writeReactiveValue.

Analyze Your Own Codebase

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

Try Supermodel Free