MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / extractTextLines

Function extractTextLines

lib/utils.ts:58–67  ·  view source on GitHub ↗
(asm: string | ParsedAsmResultLine[])

Source from the content-addressed store, hash-verified

56 * Handles the union type safely without unsafe casting.
57 */
58export function extractTextLines(asm: string | ParsedAsmResultLine[]): string[] {
59 if (typeof asm === 'string') {
60 return splitLines(asm);
61 }
62 if (Array.isArray(asm)) {
63 // Already parsed - extract text from each line object
64 return asm.map(line => line.text);
65 }
66 throw new Error(`extractTextLines called with unexpected type: ${typeof asm}`);
67}
68
69/**
70 * Converts assembly data to string format for parser consumption.

Callers 1

normalizeAsmToStringFunction · 0.85

Calls 1

splitLinesFunction · 0.70

Tested by

no test coverage detected