Home / Function/ makeSegments() — react Function Reference

makeSegments() — react Function Reference

Architecture documentation for the makeSegments() function in fork-context.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  bc75edba_70fd_7583_74d9_331bb0a69cce["makeSegments()"]
  df36c667_1df6_df81_6f12_92642f5edfce["fork-context.js"]
  bc75edba_70fd_7583_74d9_331bb0a69cce -->|defined in| df36c667_1df6_df81_6f12_92642f5edfce
  74f46095_1278_251e_054b_2f29499bdd68["makeNext()"]
  74f46095_1278_251e_054b_2f29499bdd68 -->|calls| bc75edba_70fd_7583_74d9_331bb0a69cce
  05f03e49_c3b4_ccd4_9146_75dff21e41c5["makeUnreachable()"]
  05f03e49_c3b4_ccd4_9146_75dff21e41c5 -->|calls| bc75edba_70fd_7583_74d9_331bb0a69cce
  abac50b9_8c34_9503_5ace_15f9221927d9["makeDisconnected()"]
  abac50b9_8c34_9503_5ace_15f9221927d9 -->|calls| bc75edba_70fd_7583_74d9_331bb0a69cce
  style bc75edba_70fd_7583_74d9_331bb0a69cce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/code-path-analysis/fork-context.js lines 37–56

function makeSegments(context, begin, end, create) {
  const list = context.segmentsList;

  const normalizedBegin = begin >= 0 ? begin : list.length + begin;
  const normalizedEnd = end >= 0 ? end : list.length + end;

  const segments = [];

  for (let i = 0; i < context.count; ++i) {
    const allPrevSegments = [];

    for (let j = normalizedBegin; j <= normalizedEnd; ++j) {
      allPrevSegments.push(list[j][i]);
    }

    segments.push(create(context.idGenerator.next(), allPrevSegments));
  }

  return segments;
}

Domain

Subdomains

Frequently Asked Questions

What does makeSegments() do?
makeSegments() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/fork-context.js.
Where is makeSegments() defined?
makeSegments() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/fork-context.js at line 37.
What calls makeSegments()?
makeSegments() is called by 3 function(s): makeDisconnected, makeNext, makeUnreachable.

Analyze Your Own Codebase

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

Try Supermodel Free