/** * Pass #50: string-concat-loop (CWE-1046, category: performance) * * Detects string concatenation using `+=` inside loop bodies, which creates * O(n²) string allocations. Each iteration copies the entire accumulated * string, making this a common performance anti-pattern. * * Detection strategy: * 1. Identify loop body line ranges via CFG back-edges (graph.loopBodies()). * 2. For each line within a loop body, scan for `identifier +=` pattern. * 3. Filter out obvious numeric variable names (i, count, sum, etc.) and * numeric-looking RHS literals to avoid FP on arithmetic accumulation. */ import type { AnalysisPass, PassContext } from '../../graph/analysis-pass.js'; export interface StringConcatLoopResult { /** `+=` expressions inside loop bodies that are likely string concatenation. */ concatInLoops: Array<{ line: number; variable: string; }>; } export declare class StringConcatLoopPass implements AnalysisPass { readonly name = "string-concat-loop"; readonly category: "performance"; run(ctx: PassContext): StringConcatLoopResult; } //# sourceMappingURL=string-concat-loop-pass.d.ts.map