lib/rules/process-exit-as-throw.js
function forwardCurrentToHead(analyzer, node) {
    const codePath = analyzer.codePath
    const state = CodePath.getState(codePath)
    const currentSegments = state.currentSegments
    const headSegments = state.headSegments
    const end = Math.max(currentSegments.length, headSegments.length)
    let i = 0
    let currentSegment = null
    let headSegment = null

    // Fires leaving events.
    for (i = 0; i < end; ++i) {
        currentSegment = currentSegments[i]
        headSegment = headSegments[i]

        if (currentSegment !== headSegment && currentSegment) {
            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) {
            CodePathSegment.markUsed(headSegment)
            if (headSegment.reachable) {
                analyzer.emitter.emit(
                    "onCodePathSegmentStart",
                    headSegment,
                    node
                )
            }
        }
    }
}
function forwardCurrentToHead(analyzer, node) {
    const codePath = analyzer.codePath
    const state = CodePath.getState(codePath)
    const currentSegments = state.currentSegments
    const headSegments = state.headSegments
    const end = Math.max(currentSegments.length, headSegments.length)
    let i = 0
    let currentSegment = null
    let headSegment = null

    // Fires leaving events.
    for (i = 0; i < end; ++i) {
        currentSegment = currentSegments[i]
        headSegment = headSegments[i]

        if (currentSegment !== headSegment && currentSegment) {
            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) {
            CodePathSegment.markUsed(headSegment)
            if (headSegment.reachable) {
                analyzer.emitter.emit(
                    "onCodePathSegmentStart",
                    headSegment,
                    node
                )
            }
        }
    }
}
function forwardCurrentToHead ( analyzer , node ) { const codePath = analyzer . codePath const state = CodePath . getState ( codePath ) const currentSegments = state . currentSegments const headSegments = state . headSegments const end = Math . max ( currentSegments . length , headSegments . length ) let i = 0 let currentSegment = null let headSegment = null // Fires leaving events. for ( i = 0 ; i < end ; ++ i ) { currentSegment = currentSegments [ i ] headSegment = headSegments [ i ] if ( currentSegment !== headSegment && currentSegment ) { 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 ) { CodePathSegment . markUsed ( headSegment ) if ( headSegment . reachable ) { analyzer . emitter . emit ( "onCodePathSegmentStart" , headSegment , node ) } } } }
/* istanbul ignore next 
Copied from https://github.com/eslint/eslint/blob/16fad5880bb70e9dddbeab8ed0f425ae51f5841f/lib/code-path-analysis/code-path-analyzer.js#L137

@param {CodePathAnalyzer} analyzer - The instance.
@param {ASTNode} node - The current AST node.
@returns {void}
/ * istanbul ignore next Copied from https : // github . com / eslint / eslint / blob / 16fad5880bb70e9dddbeab8ed0f425ae51f5841f / lib / code - path - analysis / code - path - analyzer . js#L137