Home / Function/ writeReactiveInstruction() — react Function Reference

writeReactiveInstruction() — react Function Reference

Architecture documentation for the writeReactiveInstruction() function in PrintReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1["writeReactiveInstruction()"]
  d77f9ffb_2d12_7d1f_126f_8c05214f0059["PrintReactiveFunction.ts"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|defined in| d77f9ffb_2d12_7d1f_126f_8c05214f0059
  cfec30fc_785b_6ff8_440a_c84098aac705["writeReactiveInstructions()"]
  cfec30fc_785b_6ff8_440a_c84098aac705 -->|calls| 5b0b4134_f31c_d57b_a687_fa6358a8ebe1
  71a9f37b_77ef_a53d_21a5_a209ffc89311["writeReactiveValue()"]
  71a9f37b_77ef_a53d_21a5_a209ffc89311 -->|calls| 5b0b4134_f31c_d57b_a687_fa6358a8ebe1
  ccaebcb0_5128_cdb1_7336_203ff87e3e3c["write()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| ccaebcb0_5128_cdb1_7336_203ff87e3e3c
  bf7f1cf7_fc0e_6bac_827c_8d36d98126da["printPlace()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| bf7f1cf7_fc0e_6bac_827c_8d36d98126da
  71a9f37b_77ef_a53d_21a5_a209ffc89311["writeReactiveValue()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| 71a9f37b_77ef_a53d_21a5_a209ffc89311
  134ef693_e561_ad46_e66b_04323b6d08cd["newline()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| 134ef693_e561_ad46_e66b_04323b6d08cd
  d9f78550_268a_9edd_94dc_21a9ffbf58ae["writeReactiveBlock()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| d9f78550_268a_9edd_94dc_21a9ffbf58ae
  2a895fc3_0c85_2027_d795_4f445574b7bc["writePrunedScope()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| 2a895fc3_0c85_2027_d795_4f445574b7bc
  c8b741bc_d083_e427_bf52_4efdedb0cfca["writeTerminal()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| c8b741bc_d083_e427_bf52_4efdedb0cfca
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"]
  5b0b4134_f31c_d57b_a687_fa6358a8ebe1 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6
  style 5b0b4134_f31c_d57b_a687_fa6358a8ebe1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PrintReactiveFunction.ts lines 139–181

function writeReactiveInstruction(
  writer: Writer,
  instr: ReactiveStatement,
): void {
  switch (instr.kind) {
    case 'instruction': {
      const {instruction} = instr;
      const id = `[${instruction.id}]`;

      if (instruction.lvalue !== null) {
        writer.write(`${id} ${printPlace(instruction.lvalue)} = `);
        writeReactiveValue(writer, instruction.value);
        writer.newline();
      } else {
        writer.write(`${id} `);
        writeReactiveValue(writer, instruction.value);
        writer.newline();
      }
      break;
    }
    case 'scope': {
      writeReactiveBlock(writer, instr);
      break;
    }
    case 'pruned-scope': {
      writePrunedScope(writer, instr);
      break;
    }
    case 'terminal': {
      if (instr.label !== null) {
        writer.write(`bb${instr.label.id}: `);
      }
      writeTerminal(writer, instr.terminal);
      break;
    }
    default: {
      assertExhaustive(
        instr,
        `Unexpected terminal kind \`${(instr as any).kind}\``,
      );
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does writeReactiveInstruction() do?
writeReactiveInstruction() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PrintReactiveFunction.ts.
Where is writeReactiveInstruction() defined?
writeReactiveInstruction() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/PrintReactiveFunction.ts at line 139.
What does writeReactiveInstruction() call?
writeReactiveInstruction() calls 8 function(s): assertExhaustive, newline, printPlace, write, writePrunedScope, writeReactiveBlock, writeReactiveValue, writeTerminal.
What calls writeReactiveInstruction()?
writeReactiveInstruction() is called by 2 function(s): writeReactiveInstructions, writeReactiveValue.

Analyze Your Own Codebase

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

Try Supermodel Free