| 320 | } |
| 321 | |
| 322 | tryGetFilenumber(asm: string, files: Record<string, number>) { |
| 323 | if (asm.startsWith('# [')) { |
| 324 | const bracketEndPos = asm.indexOf(']', 3); |
| 325 | let valueInBrackets = asm.substring(3, bracketEndPos); |
| 326 | const colonPos = valueInBrackets.indexOf(':'); |
| 327 | if (colonPos !== -1) { |
| 328 | valueInBrackets = valueInBrackets.substring(0, colonPos - 1); |
| 329 | } |
| 330 | |
| 331 | if (valueInBrackets.startsWith('/')) { |
| 332 | valueInBrackets = valueInBrackets.substring(1); |
| 333 | } |
| 334 | |
| 335 | if (Number.isNaN(Number(valueInBrackets))) { |
| 336 | if (!files[valueInBrackets]) { |
| 337 | let maxFileId = _.max(files); |
| 338 | if (maxFileId === Number.NEGATIVE_INFINITY) { |
| 339 | maxFileId = 0; |
| 340 | } |
| 341 | |
| 342 | files[valueInBrackets] = maxFileId + 1; |
| 343 | return maxFileId + 1; |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | return false; |
| 349 | } |
| 350 | |
| 351 | preProcessLines(asmLines: string[]) { |
| 352 | let i = 0; |