function endCodePath() {
    let codePath = analyzer.codePath;

    // Mark the current path as the final node.
    CodePath.getState(codePath).makeFinal();

    // Emits onCodePathSegmentEnd event of the current segments.
    leaveFromCurrentSegment(analyzer, node);

    // Emits onCodePathEnd event of this code path.
    analyzer.emitter.emit('onCodePathEnd', codePath, node);

    codePath = analyzer.codePath = analyzer.codePath.upper;
  }
Ends the code path for the current node.
@returns {void}