Call with each file a sync is about to change or remove, while its rows are there to read.
(file: string)
| 511 | |
| 512 | /** Call with each file a sync is about to change or remove, while its rows are there to read. */ |
| 513 | before(file: string): void { |
| 514 | const language = detectLanguage(file); |
| 515 | if (!LANGUAGES.some((l) => l.language === language)) return; |
| 516 | const flows = this.queries.parameterFlows; |
| 517 | let changed = this.languages.get(language); |
| 518 | if (!changed) { |
| 519 | // Taken rather than read: a sync that stops short of its pass leaves no |
| 520 | // record, and the next one starts over rather than trust a stale count. |
| 521 | changed = { record: this.settled ? parseRecord(flows.getRecord(language)) : null, before: new Map() }; |
| 522 | flows.setRecord(language, ''); |
| 523 | this.languages.set(language, changed); |
| 524 | } |
| 525 | if (changed.before.size >= MAX_CHANGED_FILES) changed.record = null; |
| 526 | if (changed.record && !changed.before.has(file)) changed.before.set(file, flows.getFlowFacts(file)); |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | function referenceOf(site: CallSiteRow, language: Language): UnresolvedReference & { filePath: string; language: Language } { |