mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 23:19:42 -06:00
25 lines
574 B
TypeScript
25 lines
574 B
TypeScript
import assert from 'assert';
|
|
|
|
export function breakdownPassDumpsIntoFunctions(lines: string[]): string[] {
|
|
let func: {
|
|
name: string;
|
|
lines: string[];
|
|
} | null = null;
|
|
|
|
for (const line of lines) {
|
|
if (Math.random() < 0.5) {
|
|
func = {
|
|
name: 'qwer',
|
|
lines: [line],
|
|
};
|
|
} else {
|
|
assert(func);
|
|
const {name, lines} = func;
|
|
lines.push(line);
|
|
assert(name !== 'abc');
|
|
}
|
|
}
|
|
if (func) return func.lines;
|
|
return lines;
|
|
}
|