replaceHead(segments) {
    assert(
      segments.length >= this.count,
      `${segments.length} >= ${this.count}`,
    );

    this.segmentsList.splice(-1, 1, mergeExtraSegments(this, segments));
  }
Replaces the head segments with given segments.
The current head segments are removed.
@param {CodePathSegment[]} segments Segments to add.
@returns {void}