Home / Function/ printFunction() — react Function Reference

printFunction() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  75108b98_1828_cb14_243d_e48c6613b748["printFunction()"]
  6976a9ee_9d8e_4f16_3016_495f39aff2fd["PrintHIR.ts"]
  75108b98_1828_cb14_243d_e48c6613b748 -->|defined in| 6976a9ee_9d8e_4f16_3016_495f39aff2fd
  eea2957a_a99b_9cf2_58bf_d591ab804347["printFunctionWithOutlined()"]
  eea2957a_a99b_9cf2_58bf_d591ab804347 -->|calls| 75108b98_1828_cb14_243d_e48c6613b748
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e["printInstructionValue()"]
  f3619b34_2818_79d3_d2a6_72b9bcfc9d1e -->|calls| 75108b98_1828_cb14_243d_e48c6613b748
  82b53eb9_7013_df20_4207_df0cdb4ba20c["printReactiveFunctionWithOutlined()"]
  82b53eb9_7013_df20_4207_df0cdb4ba20c -->|calls| 75108b98_1828_cb14_243d_e48c6613b748
  bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"]
  75108b98_1828_cb14_243d_e48c6613b748 -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da
  073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"]
  75108b98_1828_cb14_243d_e48c6613b748 -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83
  3f9f0373_2e57_1356_bd68_e2eec897e2f5["printHIR()"]
  75108b98_1828_cb14_243d_e48c6613b748 -->|calls| 3f9f0373_2e57_1356_bd68_e2eec897e2f5
  style 75108b98_1828_cb14_243d_e48c6613b748 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts lines 51–83

export function printFunction(fn: HIRFunction): string {
  const output = [];
  let definition = '';
  if (fn.id !== null) {
    definition += fn.id;
  } else {
    definition += '<<anonymous>>';
  }
  if (fn.nameHint != null) {
    definition += ` ${fn.nameHint}`;
  }
  if (fn.params.length !== 0) {
    definition +=
      '(' +
      fn.params
        .map(param => {
          if (param.kind === 'Identifier') {
            return printPlace(param);
          } else {
            return `...${printPlace(param.place)}`;
          }
        })
        .join(', ') +
      ')';
  } else {
    definition += '()';
  }
  definition += `: ${printPlace(fn.returns)}`;
  output.push(definition);
  output.push(...fn.directives);
  output.push(printHIR(fn.body));
  return output.join('\n');
}

Subdomains

Frequently Asked Questions

What does printFunction() do?
printFunction() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts.
Where is printFunction() defined?
printFunction() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PrintHIR.ts at line 51.
What does printFunction() call?
printFunction() calls 3 function(s): printHIR, printPlace, push.
What calls printFunction()?
printFunction() is called by 3 function(s): printFunctionWithOutlined, printInstructionValue, printReactiveFunctionWithOutlined.

Analyze Your Own Codebase

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

Try Supermodel Free