(code: string, keyword: "type" | "const")
| 3434 | } |
| 3435 | |
| 3436 | function collectGoTopLevelNames(code: string, keyword: "type" | "const"): string[] { |
| 3437 | const names = new Set<string>(); |
| 3438 | const lines = code.split(/\r?\n/); |
| 3439 | let inBlock = false; |
| 3440 | |
| 3441 | for (const line of lines) { |
| 3442 | if (inBlock) { |
| 3443 | if (/^\)/.test(line)) { |
| 3444 | inBlock = false; |
| 3445 | continue; |
| 3446 | } |
| 3447 | |
| 3448 | const blockMatch = /^\t([A-Z]\w*)\b/.exec(line); |
| 3449 | if (blockMatch) { |
| 3450 | names.add(blockMatch[1]); |
| 3451 | } |
| 3452 | continue; |
| 3453 | } |
| 3454 | |
| 3455 | if (new RegExp(`^${keyword}\\s*\\(`).test(line)) { |
| 3456 | inBlock = true; |
| 3457 | continue; |
| 3458 | } |
| 3459 | |
| 3460 | const singleMatch = new RegExp(`^${keyword}\\s+([A-Z]\\w*)\\b`).exec(line); |
| 3461 | if (singleMatch) { |
| 3462 | names.add(singleMatch[1]); |
| 3463 | } |
| 3464 | } |
| 3465 | |
| 3466 | return [...names].sort(compareGoTypeNames); |
| 3467 | } |
| 3468 | |
| 3469 | function generateGoSessionEventAliasFile( |
| 3470 | generatedSessionTypeCode: string, |
no test coverage detected
searching dependent graphs…