function forwardCurrentToHead(analyzer,node){var codePath=analyzer.codePath;var state=CodePath.getState(codePath);var currentSegments=state.currentSegments;var headSegments=state.headSegments;var end=Math.max(currentSegments.length,headSegments.length);var i=void 0,currentSegment=void 0,headSegment=void 0;// Fires leaving events.
for(i=0;i<end;++i){currentSegment=currentSegments[i];headSegment=headSegments[i];if(currentSegment!==headSegment&&currentSegment){debug.dump("onCodePathSegmentEnd "+currentSegment.id);if(currentSegment.reachable){analyzer.emitter.emit("onCodePathSegmentEnd",currentSegment,node);}}}// Update state.
state.currentSegments=headSegments;// Fires entering events.
for(i=0;i<end;++i){currentSegment=currentSegments[i];headSegment=headSegments[i];if(currentSegment!==headSegment&&headSegment){debug.dump("onCodePathSegmentStart "+headSegment.id);CodePathSegment.markUsed(headSegment);if(headSegment.reachable){analyzer.emitter.emit("onCodePathSegmentStart",headSegment,node);}}}}
Updates the current segment with the head segment.
This is similar to local branches and tracking branches of git.

To separate the current and the head is in order to not make useless segments.

In this process, both "onCodePathSegmentStart" and "onCodePathSegmentEnd"
events are fired.

@param {CodePathAnalyzer} analyzer - The instance.
@param {ASTNode} node - The current AST node.
@returns {void}