in tsc/src/lsif.ts [3246:3299]
public documentProcessed(sourceFile: ts.SourceFile): void {
const fileName = sourceFile.fileName;
const data = this.getDocumentData(sourceFile);
if (data === undefined) {
throw new Error(`No document data for file ${fileName}`);
}
data.flushRanges();
const handledSymbolData: Set<string> = new Set();
const validateVisibilityOn = this.validateVisibilityOn.get(fileName);
this.validateVisibilityOn.delete(fileName);
if (validateVisibilityOn !== undefined) {
for (const symbolData of validateVisibilityOn) {
const symbolId = symbolData.symbolId;
const counter = this.validateVisibilityCounter.get(symbolId);
// If the counter is already gone then the visibility already changed.
if (counter !== undefined) {
if (symbolData.keep()) {
counter.projectDataManager.manageSymbolData(symbolData);
this.validateVisibilityCounter.delete(symbolId);
} else if (counter.counter === 1) {
if (symbolData.release()) {
symbolData.changeVisibility(SymbolDataVisibility.internal);
if (this.dataMode === DataMode.free) {
handledSymbolData.add(symbolId);
symbolData.end();
let cleared = this.clearedSymbolDataItems.get(symbolId);
if (cleared === undefined) {
cleared = [];
this.clearedSymbolDataItems.set(symbolId, cleared);
}
cleared.push(symbolData.projectId);
this.removeSymbolData(symbolData);
} else {
counter.projectDataManager.manageSymbolData(symbolData);
}
}
this.validateVisibilityCounter.delete(symbolId);
} else {
counter.counter--;
}
}
}
}
const items = this.partitionLifeCycle.get(data.document.id);
if (items !== undefined) {
for (const symbolData of items) {
if (!handledSymbolData.has(symbolData.symbolId)) {
symbolData.endPartition(data.document);
}
}
}
data.end();
data.close();
}