/**
 * Analysis Pass Interface
 *
 * Defines the contract for modular analysis passes that operate on a CodeGraph.
 * Passes are run sequentially by AnalysisPipeline; each pass reads prior results
 * via context.getResult() and returns a typed result stored under its name.
 */
/**
 * Runs a sequence of AnalysisPasses, threading context between them.
 *
 * Usage:
 *   const { results, findings } = new AnalysisPipeline()
 *     .add(new TaintMatcherPass(config))
 *     .add(new ConstantPropagationPass(tree))
 *     .run(graph, code, language, config);
 */
export class AnalysisPipeline {
    passes = [];
    add(pass) {
        this.passes.push(pass);
        return this;
    }
    run(graph, code, language, config) {
        const results = new Map();
        const findings = [];
        const context = {
            graph,
            code,
            language,
            config,
            getResult(passName) {
                if (!results.has(passName)) {
                    throw new Error(`Pass '${passName}' result not available. Check pass ordering.`);
                }
                return results.get(passName);
            },
            hasResult(passName) {
                return results.has(passName);
            },
            addFinding(finding) {
                findings.push(finding);
            },
            getFindings() {
                return findings;
            },
        };
        for (const pass of this.passes) {
            const result = pass.run(context);
            results.set(pass.name, result);
        }
        return { results, findings };
    }
}
//# sourceMappingURL=analysis-pass.js.map