(asm: string | ParsedAsmResultLine[])
| 56 | * Handles the union type safely without unsafe casting. |
| 57 | */ |
| 58 | export 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. |
no test coverage detected