Home / Function/ traverseValue() — react Function Reference

traverseValue() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2046f7e5_51f5_4e62_fa3f_1036329a3746["traverseValue()"]
  af3ace55_db6d_865e_92b9_81486f6af1e7["ReactiveFunctionTransform"]
  2046f7e5_51f5_4e62_fa3f_1036329a3746 -->|defined in| af3ace55_db6d_865e_92b9_81486f6af1e7
  4b2dfca2_90c1_e230_94e6_f6d4248bdb52["traverseValue()"]
  4b2dfca2_90c1_e230_94e6_f6d4248bdb52 -->|calls| 2046f7e5_51f5_4e62_fa3f_1036329a3746
  41f8ce8e_b5b8_2fcb_46ab_0111bb06c2f2["transformValue()"]
  2046f7e5_51f5_4e62_fa3f_1036329a3746 -->|calls| 41f8ce8e_b5b8_2fcb_46ab_0111bb06c2f2
  af4d3127_0abf_3e44_50a8_d7a9dd0b9b58["visitInstruction()"]
  2046f7e5_51f5_4e62_fa3f_1036329a3746 -->|calls| af4d3127_0abf_3e44_50a8_d7a9dd0b9b58
  8d96a57b_ca06_9ec9_edd9_0932b6d3bae8["visitPlace()"]
  2046f7e5_51f5_4e62_fa3f_1036329a3746 -->|calls| 8d96a57b_ca06_9ec9_edd9_0932b6d3bae8
  4b2dfca2_90c1_e230_94e6_f6d4248bdb52["traverseValue()"]
  2046f7e5_51f5_4e62_fa3f_1036329a3746 -->|calls| 4b2dfca2_90c1_e230_94e6_f6d4248bdb52
  b2fc2985_a7ba_9865_c2a3_2a7531f27d44["eachInstructionValueOperand()"]
  2046f7e5_51f5_4e62_fa3f_1036329a3746 -->|calls| b2fc2985_a7ba_9865_c2a3_2a7531f27d44
  style 2046f7e5_51f5_4e62_fa3f_1036329a3746 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts lines 379–434

  override traverseValue(
    id: InstructionId,
    value: ReactiveValue,
    state: TState,
  ): void {
    switch (value.kind) {
      case 'OptionalExpression': {
        const nextValue = this.transformValue(id, value.value, state);
        if (nextValue.kind === 'replace') {
          value.value = nextValue.value;
        }
        break;
      }
      case 'LogicalExpression': {
        const left = this.transformValue(id, value.left, state);
        if (left.kind === 'replace') {
          value.left = left.value;
        }
        const right = this.transformValue(id, value.right, state);
        if (right.kind === 'replace') {
          value.right = right.value;
        }
        break;
      }
      case 'ConditionalExpression': {
        const test = this.transformValue(id, value.test, state);
        if (test.kind === 'replace') {
          value.test = test.value;
        }
        const consequent = this.transformValue(id, value.consequent, state);
        if (consequent.kind === 'replace') {
          value.consequent = consequent.value;
        }
        const alternate = this.transformValue(id, value.alternate, state);
        if (alternate.kind === 'replace') {
          value.alternate = alternate.value;
        }
        break;
      }
      case 'SequenceExpression': {
        for (const instr of value.instructions) {
          this.visitInstruction(instr, state);
        }
        const nextValue = this.transformValue(value.id, value.value, state);
        if (nextValue.kind === 'replace') {
          value.value = nextValue.value;
        }
        break;
      }
      default: {
        for (const place of eachInstructionValueOperand(value)) {
          this.visitPlace(id, place, state);
        }
      }
    }
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does traverseValue() do?
traverseValue() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts.
Where is traverseValue() defined?
traverseValue() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/visitors.ts at line 379.
What does traverseValue() call?
traverseValue() calls 5 function(s): eachInstructionValueOperand, transformValue, traverseValue, visitInstruction, visitPlace.
What calls traverseValue()?
traverseValue() is called by 1 function(s): traverseValue.

Analyze Your Own Codebase

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

Try Supermodel Free