Home / Function/ eachPatternOperand() — react Function Reference

eachPatternOperand() — react Function Reference

Architecture documentation for the eachPatternOperand() function in visitors.ts from the react codebase.

Function typescript MIRInfrastructure HIR calls 1 called by 12

Entity Profile

Dependency Diagram

graph TD
  f5637d03_fd91_50b8_9da7_b2a24c91bab7["eachPatternOperand()"]
  2f3caf55_cc64_415c_55dd_9771ba7dc210["visitors.ts"]
  f5637d03_fd91_50b8_9da7_b2a24c91bab7 -->|defined in| 2f3caf55_cc64_415c_55dd_9771ba7dc210
  fe7b2dbb_34c7_f07a_c558_c479a9c5eb1e["handleInstruction()"]
  fe7b2dbb_34c7_f07a_c558_c479a9c5eb1e -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  ebfb2dff_a701_0b9f_5a9e_8cd734914a21["eachInstructionLValueWithKind()"]
  ebfb2dff_a701_0b9f_5a9e_8cd734914a21 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  21b1eb1e_eaf5_5238_3a24_f56eb8ef7278["eachInstructionValueLValue()"]
  21b1eb1e_eaf5_5238_3a24_f56eb8ef7278 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  4a81cc91_29b6_ce42_c446_03ec75c6b5f2["pruneableValue()"]
  4a81cc91_29b6_ce42_c446_03ec75c6b5f2 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  c65f3ebd_fe8f_602d_b885_bc79e6e81b1d["codegenInstructionNullable()"]
  c65f3ebd_fe8f_602d_b885_bc79e6e81b1d -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  fb7d5dbf_1b8e_624d_5b62_7b7a22eeb272["transformDestructuring()"]
  fb7d5dbf_1b8e_624d_5b62_7b7a22eeb272 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  b474edef_a60d_b132_2ae0_98f6768ec241["findDisjointMutableValues()"]
  b474edef_a60d_b132_2ae0_98f6768ec241 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  3b1a75b6_5928_8dea_5f17_cf94a0c97374["visitInstruction()"]
  3b1a75b6_5928_8dea_5f17_cf94a0c97374 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  98f294c7_67b7_0dd7_2e06_f6cd2c5c5526["visitInstruction()"]
  98f294c7_67b7_0dd7_2e06_f6cd2c5c5526 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  f1ab4a04_b3ae_c2ef_cecf_f39e8b62bb49["rewriteInstructionKindsBasedOnReassignment()"]
  f1ab4a04_b3ae_c2ef_cecf_f39e8b62bb49 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2["validateContextVariableLValuesImpl()"]
  847d1bde_9ac0_7c0d_3cfa_7f96cdffa0f2 -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  b2292640_a950_f66a_1a21_4fa1d74f094d["validateNoRefAccessInRenderImpl()"]
  b2292640_a950_f66a_1a21_4fa1d74f094d -->|calls| f5637d03_fd91_50b8_9da7_b2a24c91bab7
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"]
  f5637d03_fd91_50b8_9da7_b2a24c91bab7 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6
  style f5637d03_fd91_50b8_9da7_b2a24c91bab7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts lines 332–373

export function* eachPatternOperand(pattern: Pattern): Iterable<Place> {
  switch (pattern.kind) {
    case 'ArrayPattern': {
      for (const item of pattern.items) {
        if (item.kind === 'Identifier') {
          yield item;
        } else if (item.kind === 'Spread') {
          yield item.place;
        } else if (item.kind === 'Hole') {
          continue;
        } else {
          assertExhaustive(
            item,
            `Unexpected item kind \`${(item as any).kind}\``,
          );
        }
      }
      break;
    }
    case 'ObjectPattern': {
      for (const property of pattern.properties) {
        if (property.kind === 'ObjectProperty') {
          yield property.place;
        } else if (property.kind === 'Spread') {
          yield property.place;
        } else {
          assertExhaustive(
            property,
            `Unexpected item kind \`${(property as any).kind}\``,
          );
        }
      }
      break;
    }
    default: {
      assertExhaustive(
        pattern,
        `Unexpected pattern kind \`${(pattern as any).kind}\``,
      );
    }
  }
}

Subdomains

Frequently Asked Questions

What does eachPatternOperand() do?
eachPatternOperand() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts.
Where is eachPatternOperand() defined?
eachPatternOperand() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/visitors.ts at line 332.
What does eachPatternOperand() call?
eachPatternOperand() calls 1 function(s): assertExhaustive.
What calls eachPatternOperand()?
eachPatternOperand() is called by 12 function(s): codegenInstructionNullable, eachInstructionLValueWithKind, eachInstructionValueLValue, findDisjointMutableValues, handleInstruction, pruneableValue, rewriteInstructionKindsBasedOnReassignment, transformDestructuring, and 4 more.

Analyze Your Own Codebase

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

Try Supermodel Free