Home / File/ code-path-state.js — react Source File

code-path-state.js — react Source File

Architecture documentation for code-path-state.js, a javascript file in the react codebase.

File javascript BabelCompiler Validation 9 functions 1 classes

Entity Profile

Relationship Graph

Source Code

'use strict';

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

// eslint-disable-next-line
const CodePathSegment = require('./code-path-segment');
// eslint-disable-next-line
const ForkContext = require('./fork-context');

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

/**
 * Adds given segments into the `dest` array.
 * If the `others` array does not includes the given segments, adds to the `all`
 * array as well.
 *
 * This adds only reachable and used segments.
 * @param {CodePathSegment[]} dest A destination array (`returnedSegments` or `thrownSegments`).
 * @param {CodePathSegment[]} others Another destination array (`returnedSegments` or `thrownSegments`).
 * @param {CodePathSegment[]} all The unified destination array (`finalSegments`).
 * @param {CodePathSegment[]} segments Segments to add.
 * @returns {void}
 */
function addToReturnedOrThrown(dest, others, all, segments) {
  for (let i = 0; i < segments.length; ++i) {
    const segment = segments[i];

    dest.push(segment);
    if (!others.includes(segment)) {
      all.push(segment);
    }
  }
}

/**
 * Gets a loop-context for a `continue` statement.
 * @param {CodePathState} state A state to get.
 * @param {string} label The label of a `continue` statement.
 * @returns {LoopContext} A loop-context for a `continue` statement.
 */
function getContinueContext(state, label) {
  if (!label) {
    return state.loopContext;
  }

  let context = state.loopContext;

  while (context) {
    if (context.label === label) {
      return context;
    }
    context = context.upper;
  }

  /* c8 ignore next */
  return null;
// ... (1382 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does code-path-state.js do?
code-path-state.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in code-path-state.js?
code-path-state.js defines 9 function(s): addToReturnedOrThrown, finalizeTestSegmentsOfFor, getBreakContext, getContinueContext, getReturnContext, getThrowContext, makeLooped, remove, removeConnection.
Where is code-path-state.js in the architecture?
code-path-state.js is located at packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js (domain: BabelCompiler, subdomain: Validation, directory: packages/eslint-plugin-react-hooks/src/code-path-analysis).

Analyze Your Own Codebase

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

Try Supermodel Free