import { Node } from 'ts-morph';
/**
 * Basic-block control-flow graph for an async function body. The race-
 * condition detector previously used source-line ordering as a proxy for
 * execution order — that misfires on conditional reads (`if (cond) { read }
 * await x; write`) because the analyzer cannot tell whether `read` actually
 * happened on a given execution. With a CFG we ask the precise question:
 * "Does any execution path reach `read`, then `await`, then `write` of the
 * same target?". If no such path exists → no race candidate.
 *
 * The graph is intentionally coarse: each node is a sequence of statements
 * with no internal branch. Branch / loop / try-catch / switch produce
 * separate nodes joined by `succ` edges. Statements that terminate a path
 * (`return`, `throw`, `break`, `continue`) end the block with no successor
 * to the synthetic exit. Reachability is plain forward BFS.
 *
 * Caveats:
 *   - Switch fall-through across cases is modelled correctly only when the
 *     case body ends with `break` / `return`. Implicit fall-through joins
 *     the next case's entry.
 *   - Labeled break/continue is reduced to plain break/continue (good
 *     enough for race-condition use; very rare in practice).
 *   - Nested function declarations / arrow functions are NOT followed —
 *     they have their own CFG built by the caller when needed.
 */
export interface CfgBlock {
    id: number;
    stmts: Node[];
    succ: number[];
}
export interface Cfg {
    blocks: CfgBlock[];
    entry: number;
    exit: number;
}
export declare function buildCfg(body: Node): Cfg;
/**
 * Return the CFG block id whose statement set contains `node` (walking up
 * parents until a tracked statement is found). Returns -1 when `node`
 * lives outside the CFG (nested function body, dead block, …).
 */
export declare function blockOf(cfg: Cfg, node: Node): number;
/** Forward reachability over the CFG: is `to` reachable from `from`? */
export declare function reachable(cfg: Cfg, from: number, to: number): boolean;
//# sourceMappingURL=cfg.d.ts.map