replaceHead(replacementHeadSegments) {
		assert(
			replacementHeadSegments.length >= this.count,
			`${replacementHeadSegments.length} >= ${this.count}`,
		);
		this.segmentsList.splice(
			-1,
			1,
			mergeExtraSegments(this, replacementHeadSegments),
		);
	}
Replaces the head segments with the given segments.
The current head segments are removed.
@param {Array<CodePathSegment>} replacementHeadSegments The new head segments.
@returns {void}