Home / Function/ getContinueTarget() — react Function Reference

getContinueTarget() — react Function Reference

Architecture documentation for the getContinueTarget() function in BuildReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f7a2da57_16b4_88af_75a7_54ec356e2b1d["getContinueTarget()"]
  4f68940d_e29b_1b55_8b23_bd29e8900efa["Context"]
  f7a2da57_16b4_88af_75a7_54ec356e2b1d -->|defined in| 4f68940d_e29b_1b55_8b23_bd29e8900efa
  2b0607db_4995_18d7_b551_6ff462406377["visitContinue()"]
  2b0607db_4995_18d7_b551_6ff462406377 -->|calls| f7a2da57_16b4_88af_75a7_54ec356e2b1d
  style f7a2da57_16b4_88af_75a7_54ec356e2b1d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts lines 1433–1468

  getContinueTarget(
    block: BlockId,
  ): {block: BlockId; type: ReactiveTerminalTargetKind} | null {
    let hasPrecedingLoop = false;
    for (let i = this.#controlFlowStack.length - 1; i >= 0; i--) {
      const target = this.#controlFlowStack[i]!;
      if (target.type == 'loop' && target.continueBlock === block) {
        let type: ReactiveTerminalTargetKind;
        if (hasPrecedingLoop) {
          /*
           * continuing to a loop that is not the innermost loop always requires
           * a label
           */
          type = 'labeled';
        } else if (i === this.#controlFlowStack.length - 1) {
          /*
           * continuing to the last break point, which is where control will
           * transfer to naturally
           */
          type = 'implicit';
        } else {
          /*
           * the continue is inside some conditional logic, requires an explicit
           * continue
           */
          type = 'unlabeled';
        }
        return {
          block: target.block,
          type,
        };
      }
      hasPrecedingLoop ||= target.type === 'loop';
    }
    return null;
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does getContinueTarget() do?
getContinueTarget() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts.
Where is getContinueTarget() defined?
getContinueTarget() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts at line 1433.
What calls getContinueTarget()?
getContinueTarget() is called by 1 function(s): visitContinue.

Analyze Your Own Codebase

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

Try Supermodel Free