Home / Function/ processCodePathToExit() — react Function Reference

processCodePathToExit() — react Function Reference

Architecture documentation for the processCodePathToExit() function in code-path-analyzer.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  338ea3d9_740a_9da0_1ae5_e9582eab1f95["processCodePathToExit()"]
  09a1c78a_21af_9be8_1cc6_22cf0ceb9f8f["code-path-analyzer.js"]
  338ea3d9_740a_9da0_1ae5_e9582eab1f95 -->|defined in| 09a1c78a_21af_9be8_1cc6_22cf0ceb9f8f
  dc411858_ea9d_ab2f_49db_a3428829fbde["leaveNode()"]
  dc411858_ea9d_ab2f_49db_a3428829fbde -->|calls| 338ea3d9_740a_9da0_1ae5_e9582eab1f95
  8f9baede_3c74_c103_bf16_8ed6896c980e["isHandledLogicalOperator()"]
  338ea3d9_740a_9da0_1ae5_e9582eab1f95 -->|calls| 8f9baede_3c74_c103_bf16_8ed6896c980e
  1b797861_fe3d_e47c_ac86_c6dca04010f2["isLogicalAssignmentOperator()"]
  338ea3d9_740a_9da0_1ae5_e9582eab1f95 -->|calls| 1b797861_fe3d_e47c_ac86_c6dca04010f2
  9f2557e7_03e4_e785_ae54_43d9e4959750["forwardCurrentToHead()"]
  338ea3d9_740a_9da0_1ae5_e9582eab1f95 -->|calls| 9f2557e7_03e4_e785_ae54_43d9e4959750
  f092cf3c_bb3f_e5a4_070f_c5ec14ce82a0["isIdentifierReference()"]
  338ea3d9_740a_9da0_1ae5_e9582eab1f95 -->|calls| f092cf3c_bb3f_e5a4_070f_c5ec14ce82a0
  style 338ea3d9_740a_9da0_1ae5_e9582eab1f95 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js lines 528–642

function processCodePathToExit(analyzer, node) {
  const codePath = analyzer.codePath;
  const state = CodePath.getState(codePath);
  let dontForward = false;

  switch (node.type) {
    case 'ChainExpression':
      state.popChainContext();
      break;

    case 'IfStatement':
    case 'ConditionalExpression':
      state.popChoiceContext();
      break;

    case 'LogicalExpression':
      if (isHandledLogicalOperator(node.operator)) {
        state.popChoiceContext();
      }
      break;

    case 'AssignmentExpression':
      if (isLogicalAssignmentOperator(node.operator)) {
        state.popChoiceContext();
      }
      break;

    case 'SwitchStatement':
      state.popSwitchContext();
      break;

    case 'SwitchCase':
      /*
       * This is the same as the process at the 1st `consequent` node in
       * `preprocess` function.
       * Must do if this `consequent` is empty.
       */
      if (node.consequent.length === 0) {
        state.makeSwitchCaseBody(true, !node.test);
      }
      if (state.forkContext.reachable) {
        dontForward = true;
      }
      break;

    case 'TryStatement':
      state.popTryContext();
      break;

    case 'BreakStatement':
      forwardCurrentToHead(analyzer, node);
      state.makeBreak(node.label && node.label.name);
      dontForward = true;
      break;

    case 'ContinueStatement':
      forwardCurrentToHead(analyzer, node);
      state.makeContinue(node.label && node.label.name);
      dontForward = true;
      break;

    case 'ReturnStatement':
      forwardCurrentToHead(analyzer, node);
      state.makeReturn();
      dontForward = true;
      break;

    case 'ThrowStatement':
      forwardCurrentToHead(analyzer, node);
      state.makeThrow();
      dontForward = true;
      break;

    case 'Identifier':
      if (isIdentifierReference(node)) {
        state.makeFirstThrowablePathInTryBlock();
        dontForward = true;
      }
      break;

    case 'CallExpression':

Domain

Subdomains

Called By

Frequently Asked Questions

What does processCodePathToExit() do?
processCodePathToExit() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js.
Where is processCodePathToExit() defined?
processCodePathToExit() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js at line 528.
What does processCodePathToExit() call?
processCodePathToExit() calls 4 function(s): forwardCurrentToHead, isHandledLogicalOperator, isIdentifierReference, isLogicalAssignmentOperator.
What calls processCodePathToExit()?
processCodePathToExit() is called by 1 function(s): leaveNode.

Analyze Your Own Codebase

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

Try Supermodel Free