MCPcopy
hub / github.com/eslint/eslint / replaceHead

Method replaceHead

lib/linter/code-path-analysis/fork-context.js:313–323  ·  view source on GitHub ↗

* Replaces the head segments with the given segments. * The current head segments are removed. * @param {Array } replacementHeadSegments The new head segments. * @returns {void}

(replacementHeadSegments)

Source from the content-addressed store, hash-verified

311 * @returns {void}
312 */
313 replaceHead(replacementHeadSegments) {
314 assert(
315 replacementHeadSegments.length >= this.count,
316 `${replacementHeadSegments.length} >= ${this.count}`,
317 );
318 this.segmentsList.splice(
319 -1,
320 1,
321 mergeExtraSegments(this, replacementHeadSegments),
322 );
323 }
324
325 /**
326 * Adds all segments of a given fork context into this context.

Callers 15

popForkContextMethod · 0.80
popChoiceContextMethod · 0.80
makeLogicalRightMethod · 0.80
makeIfConsequentMethod · 0.80
makeIfAlternateMethod · 0.80
popSwitchContextMethod · 0.80
popTryContextMethod · 0.80
makeYieldMethod · 0.80
popLoopContextMethod · 0.80
makeWhileTestMethod · 0.80
makeWhileBodyMethod · 0.80

Calls 2

mergeExtraSegmentsFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected