fork-context.js — react Source File
Architecture documentation for fork-context.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
'use strict';
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
// eslint-disable-next-line
const assert = require('./assert');
// eslint-disable-next-line
const CodePathSegment = require('./code-path-segment');
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Gets whether or not a given segment is reachable.
* @param {CodePathSegment} segment A segment to get.
* @returns {boolean} `true` if the segment is reachable.
*/
function isReachable(segment) {
return segment.reachable;
}
/**
* Creates new segments from the specific range of `context.segmentsList`.
*
* When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and
* `end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`.
* This `h` is from `b`, `d`, and `f`.
* @param {ForkContext} context An instance.
* @param {number} begin The first index of the previous segments.
* @param {number} end The last index of the previous segments.
* @param {Function} create A factory function of new segments.
* @returns {CodePathSegment[]} New segments.
*/
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;
}
/**
* `segments` becomes doubly in a `finally` block. Then if a code path exits by a
* control statement (such as `break`, `continue`) from the `finally` block, the
// ... (193 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does fork-context.js do?
fork-context.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 fork-context.js?
fork-context.js defines 3 function(s): isReachable, makeSegments, mergeExtraSegments.
Where is fork-context.js in the architecture?
fork-context.js is located at packages/eslint-plugin-react-hooks/src/code-path-analysis/fork-context.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